| 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("jdbc racle: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
|
 |
 |
|
|
subject: connection pool with dbcp
|
|
|