-->
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: Possible issue/bug with c3p0
PostPosted: Wed Oct 06, 2004 2:23 pm 
Beginner
Beginner

Joined: Tue Jun 22, 2004 7:50 am
Posts: 25
Hi

I'm trying to connect to a non-existent server (this happens for example, when I disconnect my machine from the network) in which case when I try to create the SessionFactory I get an infinite, repeating, exception loop.

This is my code:
Code:
    public synchronized void setConfiguration(Configuration configuration) throws HibernateException
    {
        SessionFactory oldSF = sessionFactory;
        try
        {
            sessionFactory = configuration.buildSessionFactory();
            System.out.println("Using database: " + configuration.getProperty("hibernate.connection.url"));
            try {if (oldSF != null) oldSF.close();} catch (HibernateException he){}
        }
        catch (HibernateException he)
        {
            sessionFactory = oldSF; // failed to setup new config so carry on using the current one.
            throw he;
        }
    }


I *think* this is a bug in c3p0 but I could be wrong. Any thoughts?

I'm using the jtds driver and the latest hibernate2.

Edward

Code:
java.sql.SQLException: Network error IOException: No route to host
   at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:307)
   at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
   at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:145)
   at java.sql.DriverManager.getConnection(DriverManager.java:512)
   at java.sql.DriverManager.getConnection(DriverManager.java:140)
   at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:66)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 22, 2004 5:06 am 
Newbie

Joined: Fri Apr 16, 2004 10:55 pm
Posts: 5
me too!!!

we can track this error together, can you post you configuration file? anything else useful?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 28, 2004 5:13 am 
C3P0 Developer
C3P0 Developer

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

In the version of c3p0 shipping with hibernate (0.8.4.5), c3p0 tries up to 30 times if it fails to acquire a Connection, waiting a second between each trial. If the pool fails all thirty times, it declares itself permantly broken, and all further attempts to use the pool fail.

Newer prerelease versions of c3p0 (0.8.5-preX) make the pool's behavior on acquisition failure configurable, in terms of how many times c3p0 will try if it fails to acquire a Connection, how long c3p0 will delay between attempts, and whether the pool will die or be willing to start all over again if it persistently fails to get a Connection. See http://forum.hibernate.org/viewtopic.php?p=2220210 and http://forum.hibernate.org/viewtopic.ph ... highlight= , as well as c3p0 prerelease docs, for more specific configuration instructions.

Note that I expect to release c3p0-0.8.5pre7 prior to Monday, Nov 1, so if you can, wait a couple of days for the latest.

smiles,
Steve (c3p0 maintainer)


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.