-->
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.  [ 3 posts ] 
Author Message
 Post subject: hibernate c3p0
PostPosted: Thu Mar 24, 2005 1:16 pm 
Newbie

Joined: Mon Mar 21, 2005 3:49 pm
Posts: 5
i have a application that use hibernate.
i need a automatically reconnection feature so i use c3p0.
and c3p0 works fine, it checks the db and reconnect whenn possible.

but .....

how can i react if the connection is lost, how is it possible to get the exceptions from c3p0,
or is there a other possibility to check if the db is up or down.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 5:56 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
Hi.

If the pool is unable to Connect to the database over a period of time, eventually your application will see an SQLException thrown from client calls to getConnection(). For now, there is no easy way for your application to test whether the reason for the Exception was that c3p0 determined the database to be inaccessible -- an SQLException from getConnection() could have other causes.

To resolve this, the next minor revision of c3p0 (0.9.0-pre4) will set SQL State "08001" on SQLExceptions from getConnection() resulting from a down or inaccessible database. Thus your code can determine whether the database appears to be unavailable. (In general, be careful to test for null when checking the SQL state of SQLExceptions, because often no SQL state is set, and the state defaults to null.)

smiles,
Steve (c3p0 guy)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 6:40 am 
Newbie

Joined: Mon Mar 21, 2005 3:49 pm
Posts: 5
i supposed that, but thanks for your fast answer.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.