Menu

mysql-python 1.0.0 win32: creating cursor?

Help
Anonymous
2004-08-09
2012-09-19
  • Anonymous

    Anonymous - 2004-08-09

    Hello,

    Well it seems I can't create a cursor. Based on what I have read on this forum, here is what I try:

    import _mysql
    sql = _mysql
    oDB = sql.connection( host='xxx.xxx.x.x', user='myclient', passwd='mypassword', db='mydatabase' )
    oCursor = oDB.cursor()

    I know that I'm connected, because if I run
    oDB
    I get
    <_mysql.connection open to 'xxx.xxx.x.x' at d3f768>

    When I run the above code, I get:
    Traceback (most recent call last):
      File "<interactive input>", line 4, in ?
    AttributeError: cursor

    Any suggestion?

    Thanks
    Bernard

     
    • Anonymous

      Anonymous - 2004-08-27

      Been hunting this myself-  I am not sure which fixed it but try this and see if it works for you...

      change your import statement to read:

      import MySQLdb

      <and then change to>

      sql = MySQLdb

      <and then change to>

      oDB = sql.connect( host='xxx.xxx.x.x', user='myclient', passwd='mypassword', db='mydatabase' )

      <I have seen "connection" too but it always causes problems for me.>

      -Paul

       
    • Andy Dustman

      Andy Dustman - 2004-09-07

      Sheesh.

      You're supposed to do this:

      import MySQLdb
      oDB = MySQLdb.Connection( host='xxx.xxx.x.x', user='myclient', passwd='mypassword', db='mydatabase' )
      oCursor = oDB.cursor()

      Don't go screwing around with _mysql directly.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.