-->
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.  [ 1 post ] 
Author Message
 Post subject: How can I catch JDBC connection exceptions?
PostPosted: Wed May 31, 2006 2:48 pm 
Newbie

Joined: Wed May 31, 2006 2:34 pm
Posts: 9
Hello,

is there a possibility to catch nested exceptions? I want to give a user feedback in the view, if a connection to a database cannot be established.

I found the catch block at SettingsFactory.java, which doesn't forward the exception:

Code:
catch (SQLException sqle) {
         log.warn("Could not obtain connection metadata", sqle);
      }


If this isn't possible, is there a easy method call to check the database connection?

Refused connections to the database are logged in this way:

Code:
20:11:29,202  WARN SettingsFactory:103 - Could not obtain connection metadata
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused

STACKTRACE:

java.net.SocketException: java.net.ConnectException: Connection refused


Thank you
Timo Meinen
timomeinen@googlemail.com

Hibernate version:
3.1
Name and version of the database you are using:
MySQL 4.0.21


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

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.