Error: ('im005', "[im005] [unixodbc][driver Manager]driver's Sqlallochandle On Sql_handle_dbc Failed (0) (sqldriverconnect)")
I am running this code in my pyodbc script where I am trying to do parallelism templst = [lineitem, orders, partsupp, region, cur_cur, T1, T2] connstr = [DRIVER={libdbodbc17.so};ho
Solution 1:
Aside from the problem you are having, based on your earlier question I had assumed that cursorconn
was an already opened connection that would be reused for each query. Since it now appears to be just a connection string (although in your code it doesn't seem to be an actual string, which is the same situation for the items in list templst
???), then you should be making the call conn = pyodbc.connect(cursorconn, timeout=0)
before the while True:
statement so that the same connection can be reused for multiple queries and you should then close the connection before you return from the function.
I think the problem is the statement cursor = connvar.cursor()
, which should be: cursor = conn.cursor()
. So, try the following:
conn = pyodbc.connect(cursorconn, timeout=0)
whileTrue:
try:
tableName = q.get_nowait()
time.sleep(3) # why is this here?
cursor = conn.cursor()
qry2 = "Select * FROM %s"% (tableName)
cursor.execute(qry2).fetchall()
print" extraction done of table:%s done by cursor:%s"%(tableName,cursorconn)
cursor.close() # should probably add this
except Queue.Empty:
returnfinally:
conn.close()
Post a Comment for "Error: ('im005', "[im005] [unixodbc][driver Manager]driver's Sqlallochandle On Sql_handle_dbc Failed (0) (sqldriverconnect)")"