commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil Aggarwal" <n...@JAMMConsulting.com>
Subject App not recognizing when connections closed
Date Fri, 17 Oct 2003 16:20:56 GMT
Hello:

I am writing an app using the tjdo project
(http://tjdo.sourceforge.net/) and
using dbcp to manage the database.

When I run my app initially, everything works fine.
But, if I leave it alone for a long time (about a day), when I try to
use it, I get this error:

java.sql.SQLException: No operations allowed after connection closed
at com.mysql.jdbc.Connection.checkClosed(Connection.java:2497)
at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:559)
at
org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingCon
nection.java:237)
at
com.triactive.jdo.store.DatabaseAdapter.getConnection(DatabaseAdapter.ja
va:727)

If I restart the app, things work just fine.

So, it seems that tjdo's DatabaseAdapter is not noticing when a
connection closes. 
When it attempts to re-use it, the connection throws an exception.

Here is the code I used to create the data source:
String connectURI = "jdbc:"+dbType+"://"+dbHostName+":"+port+"/"+dbName;
ObjectPool connectionPool = new GenericObjectPool(null);
Class.forName(driverClassName);
ConnectionFactory connectionFactory = new
DriverManagerConnectionFactory(connectURI,dbUser,dbPass);
PoolableConnectionFactory poolableConnectionFactory = new
PoolableConnectionFactory(connectionFactory,connectionPool,null,null,fal
se,true);
PoolingDataSource dataSource = new PoolingDataSource(connectionPool);
pmf = new com.triactive.jdo.PersistenceManagerFactoryImpl();
pmf.setConnectionDriverName(driverClassName);
pmf.setConnectionFactory(dataSource);

Any ideas on how to fix this?

Thanks,
Neil 


--
Neil Aggarwal, JAMM Consulting, (972)612-6056, www.JAMMConsulting.com
FREE! Valuable info on how your business can reduce operating costs by 
17% or more in 6 months or less! => http://newsletter.JAMMConsulting.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message