iheanyi / ibm-db

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

ibm-db module not resilient when DB2 server is restarted (local connection) #138

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I use sqlalchemy with ibm_db_sa dialect the sqlalchemy engine logic to 
re-cycle the connection pool in event of connection failure is not running 
because the the error is not recognized as a connection issue in the 
is_disconnect function under ibm_db_sa/ibm_db.py . Note that this is similar to 
issue 137 
https://code.google.com/p/ibm-db/issues/detail?id=137&thanks=137&ts=1380148277 
, but the exception is different (see bottom) so the fix in 137 doesn't catch 
it. In this case I'm using a local connection rather than a remote one. The 
local connection string is like 
ibm_db_sa://db2inst1:db2pwd@/keystone?charset=utf8

issue 137 fixes the remote connection string: 
ibm_db_sa://db2inst1:db2pwd@127.0.0.1:50000

To recreate:
1. Create a sqlalchemy engine with default connection pool params and working 
connection string. 
2. Execute a query you know works, verify still works
3. Now restart DB2 server
4. Try to excute the query again
5. You will see and exception and a rollback
6. Try running the query again, is still not working with same error

I would expect that first time the error occurs it will report this is a 
connection issue via is_disconnect() function so that sqlalchemy engine can 
refresh the connection pool. Second time you call the query it should work

Running ibm_db_sa-0.3.0 and SQLAlchemy-0.7.9 in a Ubuntu Precise x86-64

Here is the exception text:

(Pdb) p type(ex)
<class 'ibm_db_dbi.ProgrammingError'>
(Pdb) p str(ex)
'ibm_db_dbi::ProgrammingError: [IBM][CLI Driver] SQL1224N  The database manager 
is not able to accept new requests, has terminated all requests in progress, or 
has terminated the specified request because of an error or a forced interrupt. 
 SQLSTATE=55032 SQLCODE=-1224'

Original issue reported on code.google.com by BrantKnu...@gmail.com on 1 Oct 2013 at 5:53

GoogleCodeExporter commented 9 years ago
This error generally comes when database doesn't accept new connection request, 
for more information about the error you can find at 
http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.messages.sq
l.doc/doc/msql01224n.html. 

I tried to reproduce this issue in my environment but each time I get SQL30081N 
error. 

Original comment by rahul.pr...@in.ibm.com on 4 Oct 2013 at 7:08

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 18 Nov 2013 at 5:53