开发者

Hibernate - Connection not closed in connection pool

开发者 https://www.devze.com 2023-01-20 15:45 出处:网络
I am using org.apache.commons.dbcp.BasicDat开发者_JS百科aSource and I want to monitor the UNCLOSED connections.

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 than 0)
  • debugUnreturnedConnectionStackTraces (set it to true)

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消