mxODBC windows and cursors

damien_morton at my-deja.com damien_morton at my-deja.com
Fri Oct 15 22:28:40 EDT 1999


	I have been using the mxODBC library in a win32 environment,
and Ive struck a small problem. Perhaps someone can help. Here is a
snippet of code:

import ODBC.Windows
import time, random

ODBC = ODBC.Windows
SQL = ODBC.SQL

if __name__ == '__main__':
    db = ODBC.Connect('Test','sa','')
    db.setconnectoption(SQL.ACCESS_MODE, SQL.MODE_READ_ONLY)
    c = db.cursor()
    c.execute("select * from usermail where email_host='AOL.COM'")
    d = db.cursor()
    d.execute("select * from usermail where email_host='HOTMAIL.COM'")
    print c.fetchone()
    print d.fetchone()


The result of executing this code is listed below:
>>> OperationalError: ('S1000', 0, '[Microsoft][ODBC SQL Server Driver]
Connection is busy with results for another hstmt', 3205)


This seems to indicate to me that I can have only one active cursor per
connection. Is this necessarily true? Is there some way around this
limitation, or will I need to maintain a connection for each cursor?
(my tests indicate that each connection is about 600K, whereas each
cursor is about 3K)



Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Python-list mailing list