Hi, Dne 6.4.2012 07:26, nxciro napsal(a): > > dsn2='localhost:/data5/dbmaster/TEST.FDB' > testcon1=fdb.connect(dsn=dsn2,user='sysdba',password=apassword) > cur=testcon1.cursor() > testcon1.commit() > > > File > "/usr/local/lib/python2.7/site-packages/fdb-0.7.2-py2.7.egg/fdb/fbcore.py", > line 1046, in commit > self._main_transaction.commit(retaining) > File > "/usr/local/lib/python2.7/site-packages/fdb-0.7.2-py2.7.egg/fdb/fbcore.py", > line 2146, in commit > self.__check_active() > File > "/usr/local/lib/python2.7/site-packages/fdb-0.7.2-py2.7.egg/fdb/fbcore.py", > line 2077, in __check_active > raise ProgrammingError("Transaction object is not active") > fdb.fbcore.ProgrammingError: Transaction object is not active > > > The line testcon1.commit() throws this error > this does not happen in kinterbasdb. > FDB seems to expect an executed cursor prior to any commit()
FDB expects active transaction, which is not active until you execute the statement. KInterbasDB doesn't show this behavior because it opens main transaction immediately, which is not good practice, so we didn't replicate it. Because Python DB API 2.0 doesn't specify when transaction has to be implicitly started, FDB with its deferred start is in full compliance with specification. If you want generic code that always commits before SQL execution to start a new implicit transaction, check the connection.main_transaction.closed before call to commit(). best regards Pavel Cisar IBPhoenix