Re: [cx-oracle-users] Thread commits - do other threads get committed? Use Pooling?
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2010-11-10 05:15:18
|
On Tue, Nov 9, 2010 at 6:20 PM, Chapman, Scott <Sco...@pi...> wrote: > > > -----Original Message----- > From: Amaury Forgeot d'Arc [mailto:ama...@gm...] > Sent: Tuesday, November 09, 2010 4:01 PM > To: cx-...@li... > Subject: Re: [cx-oracle-users] Thread commits - do other threads get > committed? Use Pooling? > >> > 2010/11/10 Chapman, Scott <Sco...@pi...>: >> > If I use pooling, do I need to make the Connections threaded=True? > (I'm >> > thinking no, because each thread will grab a connection from the > pool, >> > begin and commit a transaction and release it's connection back to > the >> > pool). > >> Yes you need "threaded=True"; this is mostly a signal for the Oracle >> OCI library to synchronize access to shared resources like memory and >> other global structures. > > You're saying the threaded flag is doing more than the cx_Oracle docs > say it does, "indicates whether or not Oracle should use the mode > OCI_THREADED to wrap accesses to connections with a mutex." This is > supposed to be used when different threads are using a Connection object > simultaneously. If you're got a Connection Pool then each thread > acquires the connection for the duration and so I'm thinking threaded > does not need to be set. Are you quite sure of your interpretation of > the flag? Look here at the Oracle documentation for OCI_THREADED http://www.di.unipi.it/~ghelli/didattica/bdldoc/B19306_01/appdev.102/b14250/oci09adv.htm Basically, thread safety is already maintained internally for each environment handle by the Oracle libraries (in cx_Oracle an environment handle is created for each connection) and its only if you want to make use of the __same__ connection in multiple threads that you need the threaded = True constructor argument. Hope that makes sense! Anthony |