Hibernate - Connection not closed in connection pool
I am using org.apache.commons.dbcp.BasicDat开发者_JS百科aSource and I want to monitor the UNCLOSED connections. What properties i have to set in hibernate config file?
Thanks. Giovanni
It might be helpful to update your log4j configuration so the c3p0 config is printed to your log file. Just set category com.mchange.v2.c3p0 to "info". I'm having great difficulty getting my c3p0 configuration file to be picked up, so maybe yours isn't being read either.
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):
unreturnedConnectionTimeout
(set it to a value greater than0
)debugUnreturnedConnectionStackTraces
(set it totrue
)
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.
精彩评论