Error: ('HY000', 'The driver did not supply an error!')

微笑、不失礼 提交于 2020-06-17 09:10:24

问题


I have 5 different connection strings which is stored in connstr list and I have a table list which contains data stored in templst. So the contents looks like

templst = [lineitem, orders, partsupp, region, cur_cur, T1, T2]

connstr = [DRIVER={libdbodbc17.so};host=lint16muthab.phl.sap.corp:8766;UID=dba;PWD=sql;CharSet=utf8, DRIVER={libdbodbc17.so};host=localhost:8767;UID=dba;PWD=sql;CharSet=utf8,
           DRIVER={libdbodbc17.so};host=localhost:8768;UID=dba;PWD=sql;CharSet=utf8,
           DRIVER={libdbodbc17.so};host=localhost:8769;UID=dba;PWD=sql;CharSet=utf8, DRIVER={libdbodbc17.so};host=localhost:8770;UID=dba;PWD=sql;CharSet=utf8]

Now for each connstr I have opened a db connection using a db connection using

connvar = pyodbc.connect(connstr, autocommit=True)

and for each connection I have opened a cursor and stored the cursor object in list.

curlst = [<pyodbc.Cursor object at 0x7fcd9b47f270> ,<pyodbc.Cursor object at 0x7fcd9b47f330> ,<pyodbc.Cursor object at 0x7fcd9b47f390>, 
      <pyodbc.Cursor object at 0x7fcd9b47f3f0>, <pyodbc.Cursor object at 0x7fcd9b47f450> ]

So I have 5 cursor for each connection string.

Now I want to run a query for each table with these 5 cursors in parallel using multiprocessing. so the cursor1 to execute table1 and so on till cursor5 to table5 all 5 should start at same time Now among 5 cursors any one can finish so immediately it should be able to execute table6 and so on for all tables.

def extract_single(q, cursorconn):
    while True:
        try:
            tableName = q.get_nowait()
            qry2 = "Select count(*) FROM %s"%(tableName)
            cursorconn.execute(qry2)
            rowcnt = cursorconn.fetchone()[0]
            print " rows in tempdsc=",rowcnt
            print " extraction done of table:%s done by cursor:%s"%(tableName,cursorconn)
        except Queue.Empty:
            return

def main():
    q = multiprocessing.Queue()
    for item in tempdsclst:
        q.put(item) # add items to queue
    process = []
    for i in xrange(5):
        p = multiprocessing.Process(target=extract_single, args=(q, curlst[i]))
        process.append(p)
        p.start()
    for p in process:
        p.join()

It gives error like

Process Process-1:
Traceback (most recent call last):
  File "/sybopt/software/python/python/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
Process Process-2:
Traceback (most recent call last):
    self.run()
  File "/sybopt/software/python/python/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
  File "/sybopt/software/python/python/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "conn4.py", line 87, in extract_single
    cursorconn.execute(qry2)
Error: ('HY000', 'The driver did not supply an error!')
    self.run()
  File "/sybopt/software/python/python/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "conn4.py", line 87, in extract_single
    cursorconn.execute(qry2)
Error: ('HY000', 'The driver did not supply an error!')
Process Process-3:
Traceback (most recent call last):
  File "/sybopt/software/python/python/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/sybopt/software/python/python/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "conn4.py", line 87, in extract_single
    cursorconn.execute(qry2)
Error: ('HY000', 'The driver did not supply an error!')
Process Process-4:
Traceback (most recent call last):
  File "/sybopt/software/python/python/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
File "/sybopt/software/python/python/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "conn4.py", line 87, in extract_single
    cursorconn.execute(qry2)
Error: ('HY000', 'The driver did not supply an error!')
Process Process-5:
Traceback (most recent call last):
  File "/sybopt/software/python/python/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/sybopt/software/python/python/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "conn4.py", line 87, in extract_single
    cursorconn.execute(qry2)
Error: ('HY000', 'The driver did not supply an error!')

Why I am getting this error ?

来源:https://stackoverflow.com/questions/62244653/error-hy000-the-driver-did-not-supply-an-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!