-->
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 to detect DB lost connection
PostPosted: Thu Feb 11, 2010 9:06 pm 
Newbie

Joined: Thu Feb 11, 2010 9:02 pm
Posts: 3
Hi,
I have a requirement to detect whether the failure of writing to DB was due to lost connection (in which case I need to write that record to file x.csv) or due to the corrupted data (for example one column of the table was too long) (in which case I need to write the record to another file y.csv).
I have tried to use:
hibernate.c3p0.testConnectionOnCheckin=true
hibernate.c3p0.testConnectionOnCheckout=true
I was thinking that with those flags specified I might get some specific exception when I try to begin transaction (while the connection to DB is lost). However, whether I use those flags or not the exception that is being thrown is the same (org.hibernate.exception.GenericJDBCException: Cannot open connection) – so I don’t have a mechanism to figure out whether the exception is because of lost connection or anything else.
Is there a method to do what I need – can somebody point me into right direction, please?
Regards,
Janusz


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.