mxODBC problems

Larry Bates larry.bates at websafe.com
Tue Jan 9 11:57:20 EST 2007


Sean Davis wrote:
> I have just installed mxODBC on my x86_64 suse linux machine, where I
> use unixODBC for connection.  Running queries from isql or DataManager
> works fine for the DSN that I am using.  However, under mxODBC, I can
> get a connection object and a cursor object, but all attempts to
> execute even the simplest selects result in empty resultsets.  Any
> ideas on what might be wrong?
> 
>>>> from mx.ODBC.unixODBC import *
>>>> con = connect('Postgresql',user='username',password='passwd')
>>>> cur = con.cursor()
>>>> cur.execute('SELECT * FROM g_rif')
>>>> rs = cur.execute('SELECT * FROM g_rif')
>>>> rs
>>>> cur.execute('SELECT * FROM g_rif').fetchall()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: 'NoneType' object has no attribute 'fetchall'
> 
> Thanks,
> Sean
> 
I think you will find that there result returned by the
cur.execute is None upon success.  You probably meant:

cur.execute('SELECT * FROM g_rif')
table=cur.fetchall()

Then process table.

-Larry



More information about the Python-list mailing list