I have a simple INSERT INTO statement sent to SQL-Server using pymssql module.
I use the runOperation method to send the query and I get this strange error. The data goes through OK and is written in the database but SQL-Server tries to rollback. Perhaps this is a pymssql problem. In the http://code.google.com/p/pymssql/wiki/PymssqlExamples page, they state: import pymssql conn = pymssql.connect(host='SQL01', user='user', password='password', database='mydatabase') cur = conn.cursor() cur.execute('CREATE TABLE persons(id INT, name VARCHAR(100))') cur.executemany("INSERT INTO persons VALUES(%d, %s)", \ [ (1, 'John Doe'), (2, 'Jane Doe') ]) conn.commit() # you must call commit() to persist your data if you don't set autocommit to True But how can I use the con.commit method with runOperation and runQuery that I use in my application? thank you, Pandelis Theodosiou Here is the error: Traceback (most recent call last): File "/usr/lib/python2.6/threading.py", line 484, in run self.__target(*self.__args, **self.__kwargs) File "/usr/lib/python2.6/dist-packages/twisted/python/threadpool.py", line 210, in _worker result = context.call(ctx, function, *args, **kwargs) File "/usr/lib/python2.6/dist-packages/twisted/python/context.py", line 59, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/usr/lib/python2.6/dist-packages/twisted/python/context.py", line 37, in callWithContext return func(*args,**kw) --- <exception caught here> --- File "/usr/lib/python2.6/dist-packages/twisted/enterprise/adbapi.py", line 436, in _runInteraction conn.rollback() File "/usr/lib/python2.6/dist-packages/twisted/enterprise/adbapi.py", line 52, in rollback self._connection.rollback() File "/usr/lib/pymodules/python2.6/pymssql.py", line 496, in rollback raise OperationalError, "cannot roll back transaction: " + e[0] pymssql.OperationalError: cannot roll back transaction: SQL Server message 3903, severity 16, state 1, line 1: The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. DB-Lib error message 3903, severity 16: General SQL Server error: Check messages from the SQL Server
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python