• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

c3p0 configuration

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have this problem: Our application is running on a tomcat 5.5 and uses hibernate with a mysql 5 database. It works great during office hours, but when we arrive in the morning, the tomcat is still running, but the database connections had been closed by the database. Hibernate doesn't know about this and tries to use them. If we reload the page after the exception we get, it starts working, because it creates new connections.
I've been reading about this (http://www.mchange.com/projects/c3p0/index.html#configuring_recovery) and tried to configure c3p0 to handle this, but I get te same error. Also I don't know how to test this properly, so far I've been killing the connection thread with the mysql administrator.

This is the hibernate.cfg.xml



This is my c3p0.properties, which is located in the src folder of the project (the root of all packages).. does it go there?



Is my configuration ok? How can I prevent this error from happening? If it does happen, how can I prevent the application from failing?
Thanks a lot.
Pablo.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im having the same problem, when i see the stack of tcp connections from tomcat to hibernate, all the connections are in "close wait" state.
I cant figure the reason, i hope someone can help !
 
Pablo M�ller
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We modified the hibernate.cfg.xml to use a datasource, instead of passing the connection parameters there, and it seems to be working that way.
Unfortunatelly this is only a workaround and we still need to fix it the other way because we can't add datasources to the production server without restarting it, so applications should be able to handle the connection pool properly on their own.
Thanks again
 
Pablo M�ller
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found this link:
http://michaelstudman.com/fullfathomfive/articles/2004/06/07/mysql-dropping-connections-and-hibernate
He had the same problem, and fixed it using dbcp as the connection pool. So I downloaded it and configured the hibernate.cfg.xml as he did, but nothing happened. He says that hibernate will use dbcp simply adding a dbcp configuration property to the hibernate.cfg.xml. Well, I copied his config and this is what I get from hibernate:



As you can see it's still using hibernate's default connection pool. Am I missing something?
Thanks a lot.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic