Hello:

I used the following code to initialize a DBCP pool to my MySQL
database:
      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,"select
* from JDO_TABLE limit 1",false,true);
      PoolingDataSource dataSource = new
PoolingDataSource(connectionPool);
      pmf = new com.triactive.jdo.PersistenceManagerFactoryImpl();
      ((PersistenceManagerFactoryImpl)pmf).setAutoCreateTables(true);
      pmf.setConnectionDriverName(driverClassName);
      pmf.setConnectionFactory(dataSource);

My app works fine when I initially run it, but if I leave it alone for a
day,
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)

Does anyone have any way 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to