From: Ralph H. <he...@ce...> - 2002-05-29 06:23:14
|
Hello, some time ago in april I've once sent a mail to this group. However I still do not get things to run properly. I have tried to following code with python2.2 on Linux, Sybase 11.9.2, with python-sybase adapter V0.34 and V0.35pre2. Both fail with slightly different messages. What I actually want to do is just to close the cursor c1, open a new cursor c2 and then run the correct SQL there. But this also fails which is why I tried to do what Harri Pasanen suggested - unfortunately without success. Any ideas? Ralph --------------------------------------------------------- import Sybase db = Sybase.connect('monkey', 'cenix_admin', 'blabli1', 'cenix_lab') c1 = db.cursor() try: # produce an error - THE TABLE 'DUMMY' DOES NOT EXIST c1.execute('select * from dummy') except: print 'select failed' c1.close() db.commit() Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 603, in commit self.execute('commit transaction') File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 633, in execute self._raise_error(Error, 'ct_send') File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 525, in _raise_error raise exc(text) Sybase.Error: ct_send Layer: 1, Origin: 1 ct_cmd_drop(): user api layer: external error: This routine can be called only if the command structure is idle. Layer: 1, Origin: 1 ct_send(): user api layer: external error: This routine cannot be called because another command structure has results pending. Harri Pasanen wrote: > On Tue, 09 Apr 2002 10:13:34 +0200 Ralph Heinkel <rh...@ce...> wrote: > > >>Hello, >> >>every once in a while (especially after having sybase server problems) >>I get the following message: >> >>['ct_send', {'status': 0, 'sqlstate': 'ZZZZZ', 'osnumber': 0, >>'osstring': '', 'msgstring': 'ct_send(): user api layer: external error: >>This routine cannot be called because another command structure has >>results pending.', 'msgnumber': 16843057, 'severity': 1}] >> >> >>What would be the adequate reaction on this? (How do I detect this - >>the the msgnumber 16843057 unique to this error?) >> >>Thanks, >> >>Ralph >> > > > I presume you are seeing the message in the exception handler for > Sybase.Error ? > > If you can, you could try closing the open cursors, call db.commit() and > then restart the operations. > > Calling db.commit() in general seems to be a good idea for the Sybase > module (v0.34). I rearranged my code to call db.commit() before calling > stored procedures, otherwise those calls sometimes silently failed > producing wrong results, without throwing any exceptions. > > > -Harri > > -- ------------------------------------------------------------------ Ralph Heinkel Cenix Bioscience GmbH IT-Unit Director Tel : +49 351 210 2548 Pfotenhauerstr. 108 Fax : +49 351 210 1309 01307 Dresden, Germany eMail: he...@ce... |