CLI0125E Error

522 views
Skip to first unread message

Mathias

unread,
Jun 12, 2012, 3:53:24 PM6/12/12
to ibm...@googlegroups.com
Hi,

I am using ibm_db_django for a web-application and i have an error that seems to occur from time to time in my django application running on apache:

DatabaseError: ibm_db_dbi::DatabaseError: Fetch Failure: [IBM][CLI Driver] CLI0125E  Function sequence error. SQLSTATE=HY010 SQLCODE=-99999

I read about threading-issue in this regards - I am not aware of any threading in my code.

Do you have an idea what to look for?
kind regards,
Mathias

Mathias

unread,
Jun 15, 2012, 2:21:27 AM6/15/12
to ibm...@googlegroups.com
I have some more information:
I am running the application on windows, Python 2.6 using the latest ibm_db dirver.

I have tested a bit more and see problems also when running django-application in cherrypy - so it's not apache's fault. running the application with django's builtin webserver, everything works fine. But of course this webserver is not threaded.

I have an alternative driver, which we wanted to get rid off (has also some stability issues and is slower than ibm_db and especially it is not officially from IBM) and this works better than ibm_db.

I can reproduce the problem with a simple multiprocess script with 3 parallel processes, that login to my application and perform a search. ibm_db driver fails almost all the time.

Does anybody have experience running django with ibm_db on windows?

Or can anybody help me, what else I can try except trying everything on linux, which I am going to do next?
best regards,
Mathias


Mario Briggs

unread,
Jun 15, 2012, 2:34:56 AM6/15/12
to ibm_db
Hi Mathias

Sorry for not replying on this thread earlier. We were thinking could
be a DB2 CLI prefetch issue and were going to ask for a CLI trace.
However based on your second post, i think i understand what is the
issue. In your first post i didnt catch on as to what you meant by 'I
read about threading-issue in this regards', but your second thread
has clarified you are running in a multi-threaded web server versus a
multi-process web server. So i think i know what the issue is... The
ibm_db_django adaptor by default uses only persistent connections
(*) , which should not be done in multi-threaded web servers. Rahul
can you point you to the code in the ibm_db_django adaptor where this
is... if you change it from pconnect to connect, it should solve your
problem

* this is becuase for a of reasons....
- we have seen new to DB2 devs not activating the database and in
Django without having a connection-pool, this causes bad perf.
- All our users have been in linux with Apache in multi-process mode
(hence we felt 95% safe to make the adaptor use pconnect instead of
connect.

thanks
Mario

Mario Briggs

unread,
Jun 15, 2012, 2:47:09 AM6/15/12
to ibm_db

>Rahul
> can you point you to the code in the ibm_db_django adaptor where this
> is... if you change it from pconnect to connect, it should solve your
> problem
>
Pybase.py line #70

if pconnect_flag:
connection = Database.pconnect( **kwargs )
else:
connection = Database.connect( **kwargs )

change it to
connection = Database.connect( **kwargs )

Mario

Mathias

unread,
Jun 15, 2012, 3:00:58 AM6/15/12
to ibm...@googlegroups.com
Hi Mario, hi Rahul,
Thank you alot!
It is working now.
can i expect any issues by changing this line?

best regards,
Mathias

Mario Briggs

unread,
Jun 15, 2012, 3:08:42 AM6/15/12
to ibm_db
No issues at all.
Please ensure you have activated your DB2 database (that will ensure
pretty good enough performance).
If your website has huge loads, see if you can somehow throw in a
connection-pool

Mario

Mathias

unread,
Jun 15, 2012, 4:32:59 AM6/15/12
to ibm...@googlegroups.com
Database administration is not in my hands. Also the application is a rather small business application with limited load.
So I expect no further issues.
Thank you for your fast response and support.
best regards,
Mathias

Rahul

unread,
Jun 15, 2012, 5:09:44 AM6/15/12
to ibm...@googlegroups.com
Hi Mathias,
  You can change the pconnect (persistence connection)  to connect through settings.py file also. You need to add 'PCONNECT' key with 'False' value inside database property.

  e.g
   
 DATABASES = {
     
'default': {
         
'ENGINE'     : 'ibm_db_django'
         
'NAME'       : 'mydb'
         
'USER'       : 'db2inst1'
         
'PASSWORD'   : 'ibmdb2'
         
'HOST'       : 'localhost'
         
'PORT'       : '50000'
'PCONNECT' : False
     
},
   
}

Thanks,
Rahul

Mathias

unread,
Jun 15, 2012, 5:22:55 AM6/15/12
to ibm...@googlegroups.com
I will do that. This way, I can stick to your original files.
Thank you again!
Reply all
Reply to author
Forward
0 new messages