Wednesday, November 9, 2011

Timeout read connections from JDBC side on weblogic.

When a client requests data from the DB through a thread and there is no reply from the server the client indefinitely waits for the reply.
You can avoid this situation by timing out the thread from JDBC side. It will end up with a "Socket READ TIMEOUT" error so you don't indefinitely wait for a reply from server.Make sure the time period you set is strictly not shorter than any of the normal db queries of your application, else it will timeout normal connections.
works for jdbc driver versions <=10.2
does NOT work for jdbc driver versions >= 11.1

works for jdbc driver versions >=
Does not work for jdbc driver versions <

You can set it in the JDBC_Data_*-jdbc.xml in the domain/config/JDBC folder. Timeout in miliseconds.


also you can set it via console in

Admin Console -> JDBC Data Source: Configuration: Connection Pool, and set "Properties" as follows. Note to list each property=value pair on a separate line. 

To check the JDBC driver version:
 D:\work\wls\wlserver_10.3\server\lib>java -jar ojdbc6.jar
Oracle JDBC 4.0 compiled with JDK6

1 comment:

Blogger said...

BlueHost is ultimately the best hosting company with plans for all of your hosting requirements.