mxODBC attribute error with MySQL
Steve Williams
sandj.williams at gte.net
Tue Nov 7 00:04:34 EST 2000
Peter Hansen wrote:
> Keith MacDonald wrote:
> >
> > I'm trying to use mxODBC 1.1.1 with MySQL and ActivePython 2. The only
> > example I can find to get me started is in the mxODBC documentation, but
> > this is what I get when I try it:
> >
> > >>> import ODBC.MySQL
> > >>> db = ODBC.MySQL.Connect('database','user','passwd')
> > AttributeError: Connect
> >
> > (same error using "connect" as well)
> >
> > This is kind of unhelpful, as it gives me no idea what is wrong. Can anyone
> > help me with this?
>
I don't know anything about MySQL, but the following works for DB2 and, I think,
Interbase:
import ODBC.Windows
. . .
connectionODS = ODBC.Windows.Connect('ODS',user='gorgon',password='xyzzy')
cursorODS = connectionODS.cursor()
cursorODS.execute('select * from whatever')
resultSet = cursorODS.fetchall()
cursorODS.close()
connectionODS.close()
resultSet is a two-dimensional list of rows and then columns.
More information about the Python-list
mailing list