Hibernate, C3P0, Mysql — Broken Pipe

后端 未结 5 481
予麋鹿
予麋鹿 2020-12-08 16:46

MySQL seems to have an 8 hour time out on its connections. I\'m running multiple WARs in Tomcat utilizing Hibernate for ORM. After 8 hours (i.e. overnight), I get broken pip

5条回答
  •  盖世英雄少女心
    2020-12-08 17:14

    So it turns out I was missing a key line that enabled c3p0 (the c3p0 parameters I was tweaking were having no effect because Hibernate was using it's built in connection pool -- which it appropriately warns is not suitable for production). In hibernate 2.x, setting the hibernate.c3p0.max_size property enabled c3p0 connection pooling. However, in 3.x you must specify the following property --

    org.hibernate.connection.C3P0ConnectionProvider
    

    Additionally, here are my final configuration parameters --

    3
    5
    1800
    100 
    

    It's rather unfortunate that both Hibernate and c3p0 have abysmal documentation in this regard.

提交回复
热议问题