Re: [c3p0-users] LifeCycle of a connection in c3p0
Status: Beta
Brought to you by:
swaldman
From: sakin c. <sak...@gm...> - 2012-07-02 14:19:01
|
Hi Steve, c3p0 automatically tests Connections following Exceptions, and if it deems > them broken, the Connections are not placed back in the pool. > You mean, when I call con.close() connection is not placed back to pool? If this is the case, when will the substitute connection is created? > > it is possible that a Connection could break or time out between the > client's last use and its check-in to the pool. you can prevent this bu > setting c3p0.testConnectionOnCheckin to true. (Setting this parameter to > true as well as an idleConnectionTestPeriod is one of the best Connection > testing strategies to use, see > http://www.mchange.com/projects/c3p0/#configuring_connection_testing > > Steve, what does "check-in" exactly mean? Placing connection back to the pool with con.close()? > smiles, > steve > > > if you are concerned that > On Jul 2, 2012, at 4:21 PM, sakin cali wrote: > > > Hi, > > > > When do problematic connections in a pool refreshed? > > For example, given the steps below, when does the connection is > refreshed? > > > > 1. Create pool: > > > > cpds.setAcquireRetryAttempts(5); > > cpds.setAcquireRetryDelay(200); > > cpds.setPreferredTestQuery(SQLContainer.CONNECTION_TEST_SQL); > > cpds.setForceIgnoreUnresolvedTransactions(true); > > > cpds.setConnectionCustomizerClassName("com.intellica.evam.engine.db.EvamConnectionCustomizer"); > > > > 2. Get connection > > > > conn = cpds.getConnection() > > > > 3. Use connection > > .. > > .. > > .. > > .. > > exception : db connection is closed (somehow) > > .. > > > > 4. Put connection back to pool > > conn.close > > > > 5. Get connection > > > > conn = cpds.getConnection() > > > > > > > ------------------------------------------------------------------------------ > > Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and > > threat landscape has changed and how IT managers can respond. Discussions > > will include endpoint security, mobile security and the latest in malware > > threats. > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________ > > c3p0-users mailing list > > c3p...@li... > > https://lists.sourceforge.net/lists/listinfo/c3p0-users > > |