Re: Possible to make SessionPool.acquire() block until connection available?

Krishna Mohan IV <[email protected]>
Newsgroups gmane.comp.python.db.cx-oracle
Organization Oracle Corporation
Message-ID <[email protected]>
You need to use cx_Oracle. 
<http://cx-oracle.readthedocs.org/en/latest/module.html#constants>SPOOL_ATTRVAL_WAIT 
<http://cx-oracle.readthedocs.org/en/latest/module.html#constants>
in the call
cx_Oracle.SessionPool(/user/, /password/, /database/, /min/, /max/, 
/increment/[, /connectiontype/, /threaded/, 
/getmode=cx_Oracle.SPOOL_ATTRVAL_NOWAIT/, /homogeneous=True/])

The default seems to be NOWAIT.

thanks,
krishna

On 8/1/2014 10:55 AM, Vladimir Ryabtsev wrote:
> Hello, Jim,
>
> Did you consider using language synchronization primitives, like 
> threading.Semaphore or multiprocessing.Semaphore?
>
>
> 2014-08-01 0:46 GMT+04:00 Jim Freeman <[email protected] 
> <mailto:[email protected]>>:
>
>     I have an app which has more worker threads than my session pool
>     max setting, because these threads spend most of their time doing
>     wotk other than DB calls.
>     My problem is when acquire() is called and there are no available
>     connections, a cx_Oracle.DatabaseError is immediately thrown.
>     Ideally I'd like acquire() to block up to some timeout period, and
>     if multiple threads are blocked on acquire(), they received
>     connections in the same order they blocked.
>     Maybe the way the Oracle DRCP interface works (which I know little
>     about) prevents this?
>
>     ------------------------------------------------------------------------------
>     Infragistics Professional
>     Build stunning WinForms apps today!
>     Reboot your WinForms applications with our WinForms controls.
>     Build a bridge from your legacy apps to the future.
>     http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
>     _______________________________________________
>     cx-oracle-users mailing list
>     cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>     <mailto:cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
>     https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
>
>
> _______________________________________________
> cx-oracle-users mailing list
> cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds

_______________________________________________
cx-oracle-users mailing list
cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.