I think it will be easier if you can config your DBCP as a JNDI resource. Check out http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how to.html
Thanks Daniel -----Original Message----- From: Paul Tomsic [mailto:[EMAIL PROTECTED] Sent: Thursday, March 25, 2004 5:15 PM To: [EMAIL PROTECTED] Subject: DBCP abandoned connections piling up, never clearing, reaching max_connections Tomcat 4.1.30, MySql 4.0.18-standard, dbcp-1.1,mysql jdbc 3.0.9 We're using mysql on a different box than the tomcat. The problem we're having is, when we deploy to the box using ant, and watch the mysql process list, 5-7 connections start immediately and stay "sleeping" for ever. Then, every time we make a connection to the DB from within the application, it's not being cleaned up. So, new connections are made all the time, and never cleaned up, not to mention that the initial 5 or so that are started when the app is deployed stay sleeping forever. Within a brief period of heavy activity, we have to stop everything, b/c we're out of connections. We have a class that handles the pool, w/ a private instance constructor and the following: DriverAdapterCPDS cpds = new DriverAdapterCPDS(); SharedPoolDataSource tds = new SharedPoolDataSource(); cpds.setDriver(dbDriver); cpds.setUrl(dbUri); cpds.setUser(dbUser); cpds.setPassword(dbPass); tds.setConnectionPoolDataSource(cpds); tds.setMaxActive(0); tds.setMaxWait(50); tds.setTimeBetweenEvictionRunsMillis(20); DataSource ds = tds; Then there's a method that simply returns ds.getConnection() from within that singleton pool class. When we get a connection, it's wrapped in a try/catch/finally where inside the finally we conn.close() explicitly. Sorry to be long, but anyone have any thoughts? thanks in advance. __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
