<font class="fixed_width" face="Courier, Monospaced">(Reposted to DB-SIG from clp)<br><br>This week, I used the adodbapi module against an SQL Server Express <br> database. I was surprised to get an exception, when I attempted to <br>
submit a second query with my cursor object. The full session is <br> below. <br> </font><p><font class="fixed_width" face="Courier, Monospaced">With cx_Oracle I've become used to reusing a cursor for subsequent <br>
queries. The PEP doesn't specify either way, that I can see. Is this <br> behaviour left to the implementation, or should I be able to expect a <br> cursor is reusable? <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">With thanks, Alex <br>
</font></p><p><font class="fixed_width" face="Courier, Monospaced">Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit <br> (Intel)] on win32 <br> Type "help", "copyright", "credits" or "license" for more information. <br>
</font></p><div id="qhide_209932" style="display: block;" class="qt"><font class="fixed_width" face="Courier, Monospaced">>>> import adodbapi <br>
>>> conn = adodbapi.connect('Provider=SQLOLEDB.1;Data
Source=.\\SQLEXPRESS;Initial Catalog=MYDATABBASE;Integrated
Security=SSPI;User Instance=False;') <br> >>> curs = conn.cursor() <br> >>> curs.execute('select * from localview_roles') <br> >>> curs.execute('select * from localview_roles') <br>
<br></font></div><font class="fixed_width" face="Courier, Monospaced">Traceback (most recent call last): <br> File "<stdin>", line 1, in <module> <br> File "C:\Python25\Lib\site-packages\adodbapi\adodbapi.py", line 713, <br>
in execut <br> e <br> self._executeHelper(operation,False,parameters) <br> File "C:\Python25\Lib\site-packages\adodbapi\adodbapi.py", line 664, <br> in _execu <br> teHelper <br> self._raiseCursorError(DatabaseError,tracebackhistory) <br>
File "C:\Python25\Lib\site-packages\adodbapi\adodbapi.py", line 474, <br> in _raise <br> CursorError <br> eh(self.conn,self,errorclass,errorvalue) <br> File "C:\Python25\Lib\site-packages\adodbapi\adodbapi.py", line 60, <br>
in standar <br> dErrorHandler <br> raise errorclass(errorvalue) <br> adodbapi.adodbapi.DatabaseError: <br> --ADODBAPI <br> Traceback (most recent call last): <br> File "C:\Python25\Lib\site-packages\adodbapi\adodbapi.py", line <br>
650, in _exec <br> uteHelper <br> adoRetVal=self.cmd.Execute() <br> File "<COMObject ADODB.Command>", line 3, in Execute <br> File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", <br>
line 258, in <br> _ApplyTypes_ <br> result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, <br> retType, argTypes <br> ) + args) <br> com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft OLE <br>
DB Provider <br> for SQL Server', u'Cannot create new connection because in manual or <br> distribute <br> d transaction mode.', None, 0, -2147467259), None) <br> -- on command: "select * from localview_roles" <br>
-- with parameters: None </font><font class="fixed_width" face="Courier, Monospaced"></font>