Tech Per

28 Jan

Oracle ReadTimeout - A Really Useful Oracle Driver Property

For some time now, I have been bugged by a firewall somewhere along the path between my development machine and our Oracle database. The firewall seems to close the open database connections after some time of inactivity. It was particularly irritating, as my favourite SQL plugin in IDEA locked up IDEA totally, needing a kill and a restart, to get IDEA going again :-( An analysis of the thread stack when IDEA being in dead-state told me, that it (the plugin code) was waiting on a lock in a socket read, some way deep down in the Oracle driver code.

Rather than have some firewall administrator take a look at it, I myself took a look at Oracles properties for the driver, and found an interesting one:

oracle.jdbc.ReadTimeout

The description of it reads:

Read timeout while reading from the socket. This affects thin driver only. Timeout is in milliseconds.

Setting this property on the connection to 10000 (10 seconds) was all it took to solve the problem. Well, the firewall still closes the connection, but it takes me only 10 seconds, to get IDEA back again. After that, the connection is dropped (by the SQL Query Plugin), and a new one is opened. Lovely!

UPDATE: The list of properties for the Oracle Thin Driver can be seen here.

Leave a Reply

© 2009 Tech Per | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo