Allan Brockenbrough

Greenhorn
+ Follow
since Nov 07, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Allan Brockenbrough

I'm having a problem configuring the timeout that is used when establishing a new connection to an Oracle database when using a connection pool.

I'm using DBCP in Tomcat and XML to configure the resource (below). I'm using the oracle thin jdbc.

In the source code I get a DataSource and connection like this:

DataSource ds = (DataSource) envCtx.lookup("jdbc/anncDB");
Connection conn = ds.getConnection();

This works fine if the IP specified in the url is available. But if it is not available, it takes 3 minutes before getConnection() returns. I need to configure this to be smaller.

I've tried setLoginTimeout(), but that doesn't work. Doing ds.setLoginTimeout() takes 3 minutes before failing.

Any ideas?

Allan
-------

<Context path="/aeservlet">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="aeservlet." suffix=".log" timestamp="true"/>
<Resource name="jdbc/anncDB"
auth="Container"
type="javax.sql.DataSource"
maxActive="10"
maxIdle="1"
maxWait="5000"
username="xxxx"
password="xxxx"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@10.0.0.0:1521:ODS"
factory="org.apache.commons.dbcp.BasicDataSourceFactory"
connectionProperties=""
removeAbandoned="1"
removeAbandonedTimeout="1"
description="Resource in server.xml GlobalNamingResources"/>
</Context>

Oracle driver version: v10.2.0