how to cancel connecting to database which is down?

Michał Nowotka <[email protected]>
Newsgroups gmane.comp.python.db.cx-oracle
Message-ID <CAAGvU1ZcePx3yFUektvhM09tFaypwBhWGwuB-NANAVEkG_ts5Q@mail.gmail.com>
Hello,

Please take a look at this simple code:

    import cx_Oracle as db
    dsn = '(DESCRIPTION
=(CONNECT_TIMEOUT=3)(RETRY_COUNT=1)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST
=(ADDRESS = (PROTOCOL = TCP)(HOST = SOME_HOST)(PORT =
1531)))(CONNECT_DATA =(SERVICE_NAME = SOME_NAME)))'
    connect_string = "LOGIN/PASSWORD@%s" % dsn
    conn = db.connect(connect_string)
    conn.ping() # WILL HANG FOREVER!!!

If `SOME_HOST` is down, this will hang forever!

And it's not related to `OCIPing` - if I replace:

    ping()

with:

    cursor = conn.cursor()
    cursor.execute('SELECT 1 FROM DUAL') # HANG FOREVER AS WELL

This will hang as well.

I'm using **SQL*Plus: Release 11.2.0.3.0 Production on Wed Nov 6
12:17:09 2013**.

I tried wrapping this code in thread and waiting for same time than
killing the thread but this doesn't work. This code creates a thread
itself and it's impossible from python to kill it. Do you have any
ideas how to recover?


Kind regards,

Michał Nowotka

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
cx-oracle-users mailing list
[email protected]
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.