Reputation:
I have an application that uses connection pooling to get database connection from an Oracle9i release 9.2.0.4 database. Application is hosted in SJSAS 8.1 and the driver is ojdbc14.jar
version 10.1.0.4.
The problem I'm having is datasource.getConnection()
method is taking about 40 secs to throw an exception when the DB is down! This is causing the application to get overloaded during a DB outage. I tried setting LoginTimeout=8
with the datasource but it has no effect.
Please see below the datasource I'm using
<jdbc-connection-pool connection-validation-method="table"
datasource-classname="oracle.jdbc.pool.OracleDataSource"
fail-all-connections="true"
idle-time out-in-seconds="600"
is-connection-validation-required="true"
is-isolation-level-guaranteed="false"
max-pool-size="100"
max-wait-time-in-millis="8000"
name="mydb"
pool-resize-quantity="80"
res-type="javax.sql.DataSource"
steady-pool-size="20"
validation-table-name="dual">
<property name="url" value="jdbc:oracle:thin:@server1:1521:mydb"/>
<property name="user" value="user1"/>
<property name="LoginTimeout" value="8"/>
<property name="password" value="pass1"/>
</jdbc-connection-pool>
Can any one please help? I need the getConnection()
method to timeout with in the timeout given.
Upvotes: 0
Views: 7863
Reputation: 4637
Here's a few things to try:
From "Oracle® Database JDBC Developer's Guide and Reference".
Using JDBC with Firewalls
Firewall timeout for idle-connections may sever a connection. This can cause JDBC applications to hang while waiting for a connection. You can perform one or more of the following actions to avoid connections from being severed due to firewall timeout:
oracle.net.READ_TIMEOUT
as
connection property to enable read
timeout on socket. The timeout value
is in milliseconds.tcp_keepalive_interval
.SQLNET.EXPIRE_TIME=1
in the
sqlnet.ora
file on the server-side.Upvotes: 1