aspose file tools*
The moose likes JDBC and the fly likes connection pool with dbcp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "connection pool with dbcp" Watch "connection pool with dbcp" New topic
Author

connection pool with dbcp

vicky pribadhy
Greenhorn

Joined: Mar 05, 2007
Posts: 5
Hi all,

i have a problem while i'm using dbcp. i set 10 for maxActive. While my program is running, there are a lot connection instance created to oracle that inactive. so the oracle will lost connection resource.
can you give me some advice to avoid this problem

regards,

Vicky
Gaurav Arora
Ranch Hand

Joined: Aug 13, 2007
Posts: 35
Some code would be most helpful.
vicky pribadhy
Greenhorn

Joined: Mar 05, 2007
Posts: 5
// method init will use to initialize properties

public static void init() throws Exception {

DriverAdapterCPDS myConnectionPoolDataSource = new DriverAdapterCPDS();
myConnectionPoolDataSource.setDriver("oracle.jdbc.driver.OracleDriver");

myConnectionPoolDataSource.setUrl("jdbcracle:thin:@localhost:1521:ORCL");

myConnectionPoolDataSource.setUser("userName");
myConnectionPoolDataSource.setPassword("userPassword");

sharedDataSource = new SharedPoolDataSource();

sharedDataSource.setConnectionPoolDataSource(myConnectionPoolDataSource);
sharedDataSource.setMaxActive(10);
sharedDataSource.setMaxWait(60);
sharedDataSource.setMaxIdle(10);
}


// method getConnection will use to get connection from pool

public static Connection getConnection() throws SQLException {
return sharedDataSource.getConnection();
}

regards,

Vicky
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: connection pool with dbcp