title: Attribute error with MySQL's connection object
body: <p>I am <em>trying</em> to use this script to create a connection and search with MySQL database. <br/> </p>
  
  <pre><code>#!/usr/bin/env python
  import MySQLdb as msd
  import json
  class Test_oop():
      host = "localhost"
      user = "root"
      password = "123456"
      database = "test_1"
  
      def __init__(self):
          self.dbs = None
  
      def create_connection(self):
          self.dbs = msd.connect(self.host,self.user,self.password, self.database)
  
      def close_connection():
          self.dbs.close()
  
      def search(self, name):
          cursor = self.dbs
          print type(cursor)
          cursor.execute("SELECT adress FROM phoneID WHERE Name = %s", (name))
          return cursor.fetchall()
  </code></pre>
  
  <p>But when i try to run it, I get the following error:</p>
  
  <pre><code>&gt;&gt;&gt; from test_oop import Test_oop as top
  &gt;&gt;&gt; search_query = top()
  &gt;&gt;&gt; search_query.create_connection()
  &gt;&gt;&gt; search_query.search('Tommy')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "test_oop.py", line 42, in search
      cursor.execute("SELECT adress FROM phoneID WHERE Name = %s", (name))
  AttributeError: 'Connection' object has no attribute 'execute'
  </code></pre>
  
  <p>I did a <code>type()</code>on <code>cursor</code> after <code>cursor=self.dbs</code>in <code>search()</code> method
  and i found that <code>cursor</code> is a <code>&lt;class 'MySQLdb.connections.Connection'&gt;
  </code>
  I am not sure what am I missing?</p>