-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: How to keep database connection alive for production server
PostPosted: Wed Jan 14, 2009 8:29 am 
Newbie

Joined: Wed Jan 14, 2009 8:23 am
Posts: 3
Hi All,


I am using hibernate,Mysql and JBOSS server,i want to know how can i keep the database connection alive,i would communication link failure error after some period of time, I am sing c3p0 ,but it dint helped me out.

Can anyone say what configuration i should do to set for production.

Thankx


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2009 9:29 am 
Beginner
Beginner

Joined: Wed Apr 18, 2007 6:17 pm
Posts: 49
Location: Dominican Republic
Hello sams11, this issue it's related to mysql. It's a very common behavior with the connection pool an mysql. Mysql by default closes a connection that it's been idle for a period of ~8 hours. You could tell c3p0 that query the db within a period of time shorter that the one that it's configured in mysql and you'll be fine.

regards,


Top
 Profile  
 
 Post subject: keeping mysql connection alive
PostPosted: Thu Jan 15, 2009 2:15 am 
Newbie

Joined: Wed Jan 14, 2009 8:23 am
Posts: 3
Hi,

I have used c3p0 to query the db,these r the settings i have done

in hibernate.cfg.xml
<property name="hibernate.c3p0.idle_test_period">25200</property>

and i have c3p0 jar file and property file contains

c3p0.preferredTestQuery=SELECT userName from test.user where userName='admin'
c3p0.testConnectionOnCheckout=true

even with these query its not keeping the mysql connection alive.And i want to know if no one pings within 8hrs whether we need to restart the server?if not how can i manage with c3p0,its not working fine.I have to restart the server if no one pings for 8hrs.

CAn any one suggest me the solution,i want to keep it running.

Thankx.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 10, 2009 1:44 pm 
Newbie

Joined: Tue Feb 10, 2009 1:36 pm
Posts: 1
I too have had the issue you have described and have tried all sorts of hibernate configurations, although I am new to using hibernate. Thus far the only solution I have found is to add these arguments when starting the MySQL server, --connect_timeout and --wait_timeout. Not ideal and I am still looking for a better solution but at least for now it works.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.