waliwali / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

ibm_db doesn't support SAVEPOINT? #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Simple test script:

import ibm_db
ibm_db_conn = ibm_db.connect('pydev', 'db2inst1', 'secret')
import ibm_db_dbi
conn = ibm_db_dbi.Connection(ibm_db_conn)
cur = conn.cursor()
cur.execute('SAVEPOINT test ON ROLLBACK RETAIN CURSORS')
cur.execute('RELEASE SAVEPOINT test')

will cause exception:

ProgrammingError: ibm_db_dbi::ProgrammingError: Statement Execute Failed: 
[IBM][CLI Driver][DB2/LINUXX8664] SQL0880N  SAVEPOINT "TEST" does not exist or 
is invalid in this context.  SQLSTATE=3B001 SQLCODE=-880

The test works fine with pyodbc.

Original issue reported on code.google.com by sok...@gmail.com on 5 Apr 2012 at 9:59

GoogleCodeExporter commented 9 years ago
Found the problem...

>>> ibm_db.autocommit(ibm_db_conn)
1

>>> ibm_db.autocommit(conn)
0

Autocommit is actually still on. Reopen issue 6?

Original comment by sok...@gmail.com on 5 Apr 2012 at 10:34

GoogleCodeExporter commented 9 years ago
This patch fixes the problem for me.

Original comment by sok...@gmail.com on 5 Apr 2012 at 10:46

Attachments:

GoogleCodeExporter commented 9 years ago
Update patch to apply the change to both connect and pconnect.

Original comment by sok...@gmail.com on 6 Apr 2012 at 7:02

Attachments:

GoogleCodeExporter commented 9 years ago
The error you are getting in SAVEPOINT is because of your application is in 
autocommit mode and in this mode there is no concept of SAVEPOIT.

Please turn autocommit OFF before using SAVEPOINT, you can set it by following 
command.

>>>ibm_db_dbi.set_autocommit(0)

I am agree with your view regarding autocommit default value. We will modify 
this in our next release.

Original comment by rahul.pr...@in.ibm.com on 12 Apr 2012 at 8:41

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 12 Apr 2012 at 8:42

GoogleCodeExporter commented 9 years ago
Fixed and released with ibm_db-1.0.6

Original comment by rahul.pr...@in.ibm.com on 25 May 2012 at 6:51

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 25 May 2012 at 6:52