[DB-SIG] threads sharing connection with cx_Oracle

Anthony Tuininga anthony at computronix.com
Sun Jan 25 00:05:57 EST 2004

You do need to ensure that the OCI threading option is turned on.
Specifically, you need to set the following module level flag:

cx_Oracle.OPT_Threading = 1

If you don't, you will find the program very unstable. :-) Otherwise,
things are rock solid in our experience. We have run stress tests on
applications with 30 threads for several hours at a time and not noticed
any problems.

On Sat, 2004-01-24 at 12:05, Randall Smith wrote:
> Are there any known issues with threads sharing a connection with cx_Oracle?
> Environment:  cx_Oracle for Oracle 8i and Python2.3, Oracle 8.1.5
> The top level program creates a connection.  It then creates threads and 
> passes that connection in to each thread as an argument so that all 
> threads are sharing the connection.  Each thread creates a cursor as 
> needed and issues only SELECT statements.  After about 10 threads have 
> been created the next thread throws an Oracle Exception with a message 
> something like 'End of string line ...'.  Sorry about the vagueness on 
> the error messgae, I'm at home and don't have access to it now.
> I set up the same environment using psycopg/Postgresql and didn't have 
> any problem.  So I think it is specific to Oracle or cx_Oracle.
> I can get the exact error message on Tuesday, but I'm sending this 
> message now in hopes that someone is already familiar with this problem.
> Randall Smith
> _______________________________________________
> DB-SIG maillist  -  DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig
Anthony Tuininga <anthony at computronix.com>

More information about the DB-SIG mailing list