ODBC Select

Larry none at none.com
Wed Nov 17 20:53:16 EST 2004


I am trying to connect to my MySQL database using python and ODBC.

Here is what I am doing.

 >>> import dbi,odbc
 >>> conn=odbc.odbc("dsn=facs")
 >>> cursor=conn.cursor()
 >>> cursor.execute("select * from data")
0
 >>>

Notice I get the "0" after the select statement.
Problem is, there are 20 records in the database.  In fact I can do this

 >>> cursor.execute("insert into data (facility) values ('AAA')")
1
 >>>

and then I can do this

 >>> cursor.execute("delete from data where id > 20")
1
 >>>

but when I do

 >>> cursor.execute("select * from data")
0
 >>>

Anyone seen this and can maybe tell me why this is occuring.  I have 
full privileges as I can log on and query with the DSN from other programs.

Thanks,
Larry






More information about the Python-list mailing list