-->
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: Connection error management
PostPosted: Tue Apr 04, 2006 4:52 am 
Newbie

Joined: Thu Mar 30, 2006 8:23 am
Posts: 19
Location: FRANCE 67
Hello,

I am using hibernate 3.0 in a J2EE webApp (Tomcat whith DB2/ MySql / Oracle) with 2 sessionFactories. The first one is static (The default HibernateUtil.java). The second one use the first sessionFactory to get the configuration of the second. I also use the pool manager c3p0 in both sessionFactories.

When the configuration is OK and the database is OK, There is no error. But when the connection is refused, c3p0 try to reconnect all the time and it slows myApp. How can I control the reconenction or how can I close the sessionFactory when the first connection doesn't work?

To do this, I'd like to catch the following connection exception :

java.sql.SQLException: Exception d'E/S: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=134238208)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:324)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:266)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:68)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:87)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0PooledConnectionPool.java:83)
at com.mchange.v2.resourcepool.BasicResourcePool.assimilateResource(BasicResourcePool.java:884)
at com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool.java:601)
at com.mchange.v2.resourcepool.BasicResourcePool.access$400(BasicResourcePool.java:31)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1079)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:354)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 6:03 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Hello,

you can set the number of times c3p0 tries to
connect with a file c3p0.properties in you classpath
containing:
Code:
c3p0.acquireRetryAttempts = 1


As for the exception. There was a patch for c3p0 shortly.
You may read:
[url]
http://sourceforge.net/mailarchive/foru ... m_id=35722
[/url]

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 11:13 am 
Newbie

Joined: Thu Mar 30, 2006 8:23 am
Posts: 19
Location: FRANCE 67
In fact, I'd like to know if the user has entered the good connection URL. Is there an easy way to test this with hibernate or other?

Thanks


steckemetz wrote:
Hello,

you can set the number of times c3p0 tries to
connect with a file c3p0.properties in you classpath
containing:
Code:
c3p0.acquireRetryAttempts = 1


As for the exception. There was a patch for c3p0 shortly.
You may read:
[url]
http://sourceforge.net/mailarchive/foru ... m_id=35722
[/url]


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.