wood burning stoves 2.0*
The moose likes JDBC and the fly likes DataSource getConnection() configuring new connection timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "DataSource getConnection() configuring new connection timeout" Watch "DataSource getConnection() configuring new connection timeout" New topic
Author

DataSource getConnection() configuring new connection timeout

Allan Brockenbrough
Greenhorn

Joined: Nov 07, 2008
Posts: 1
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="jdbcracle: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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DataSource getConnection() configuring new connection timeout
 
Similar Threads
No suitable driver error when configuring JDBC datasource for Tomcat and Struts
Oracle Datasource for jboss
Connection pooling in tomcat
No suitable driver error when configuring JDBC datasource for Tomcat and Struts
Jboss connection pool not releasing the connection from pool