title: 'str' object has no attribute 'cursor'
body: <pre><code>connection_1 = MySQLdb.connect(host =&quot;localhost:3306&quot;,user = &quot; &quot;,password = &quot; &quot;,db =&quot;hospital&quot;)
  
  def oracle1_database():
      connection_1 = Connection_entry.get()
      user = Username_entry.get()
      passw = Password_entry.get()
      db = connection_1
      print(db)
      cursor = db.cursor()
      print(&quot;xz1&quot;,cursor)
      a1 = cursor.execute(&quot;select * from a1&quot;)
      print(a1)
  
      try:
          cursor.execute(a1)
          myresult = cursor.fetchall()
  
          for x in myresult:
              savequery_data = x
              print(savequery_data)
  
          print(&quot;Query executed successfully&quot;)
      except:
          db.rollback()
          print(&quot;Error occured&quot;)
  </code></pre>
  <p>Please tell me how to solve the error.</p>
  <p>I create a GUI in that I take 3 input 1 is connection string, 2 names, 3 is a password with the help of GUI when I enter the connection</p>
  <pre><code>string(MySQLdb.connect(host =&quot;localhost:3306&quot;, user = &quot; &quot;, password = &quot; &quot;, DB =&quot; hospital&quot;)) 
  </code></pre>
  <p>it gives detail of the database query which I have written in the program I have multiple databases (Oracle, MongoDB, SQL....) when I write connection string in 1st input box it takes the database which I want and runs the query. There I write code but I get an error</p>
  <blockquote>
  <p>Exception in Tkinter callback<br />
  Traceback (most recent call last):<br />
  File &quot;D:\python\envs\hospital data\lib\tkinter_<em>init</em>_.py&quot;, line 1883, in <strong>call</strong><br />
  return self.func(*args)</p>
  <p>File &quot;D:/hospital data/mis1.py&quot;, line 32, in oracle1_database<br />
  cursor = a21.cursor()<br />
  AttributeError: 'str' object has no attribute 'cursor'</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/z49kH.png" rel="nofollow noreferrer">enter image description here</a></p>