views:

27

answers:

1

I am using org.apache.commons.dbcp.BasicDataSource and I want to monitor the UNCLOSED connections. What properties i have to set in hibernate config file?

Thanks. Giovanni

A: 

I am not sure this is something supported by DBCP (if it is, maybe add a link to the documentation).

However, it should be possible using C3P0 and the following properties (see this previous answer):

You'll have to set them in the c3p0.propeties (see Appendix C: Hibernate-specific notes).

Another option would be to use BoneCP.

But I wonder why you need this, I'm pretty sure Hibernate is not leaking connections.

Pascal Thivent
I want found the connection that programmers didn't close. I am using C3P0 now and I have setted the two properties but it doesn't write anything!
Giovanni R.
@Giovanni I'm afraid you're not providing enough details to get more help.
Pascal Thivent
Sorry. I put the snippet of applicationContext.xml of Spring of connection parameters: <bean id="inteseDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> ....<property name="unreturnedConnectionTimeout" value="30" /> <property name="debugUnreturnedConnectionStackTraces" value="true" /> I hope it logs the connections not closed by programmers but it doesn't it.
Giovanni R.