my c3p0 configuration :
hibernate.connection.provider_class = "org.hibernate.connection.C3P0ConnectionProvider"; hibernate.c3p0.min_size = 1; hibernate.c3p0.max_size = 5; hibernate.c3p0.timeout = 60; hibernate.c3p0.acquire_increment = 2; hibernate.c3p0.acquireRetryDelay = 20; hibernate.c3p0.acquireRetryAttempts = 2; hibernate.c3p0.idle_test_period = 10; hibernate.c3p0.max_statements = 0; hibernate.c3p0.maxIdleTimeExcessConnections = 60; hibernate.c3p0.preferredTestQuery = "SELECT 1 FROM DUAL";
I read ‘testConnectionOnCheckout’ is the best way to ensure connection availability but do not want to use it considering the expense that it will slow down the application.
Hence added the idle_test_period. But even then, connection closes when kept Idle for 8 hours (standard time for mysql after which connection closes automatically). Am I missing out anything in the configuration?