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: probleme de connection (Execution de plus d'un client)
PostPosted: Wed Dec 13, 2006 7:09 am 
Newbie

Joined: Wed Dec 13, 2006 6:48 am
Posts: 7
[b]Hibernate 3.2 [/b]

Bonjour
j'ai 2 programme qui tourne au même temps, ils se connectent à la même BD.

voici la configuration de hibernate:

[code]
org.hibernate.cfg.Configuration cfg = new org.hibernate.cfg.Configuration()
.setProperty("hibernate.connection.driver_class",Driver)
.setProperty("hibernate.dialect", Dialect)
.setProperty("hibernate.connection.url", Url)
.setProperty("hibernate.connection.user",user)
.setProperty("show_sql","true")
.setProperty("hibernate.connection.password",pass)
.setProperty("hibernate.transaction.factory_class","org.hibernate.transaction.JDBCTransactionFactory")
.setProperty("hibernate.c3p0.min_size","5")
.setProperty("hibernate.c3p0.max_size","10")
.setProperty("hibernate.c3p0.timeout","0")
.setProperty("hibernate.c3p0.max_statements","0")
.addResource("CMPI_Messagedetails.hbm.xml"); [/code]

et voici le bou du code ou reside le probleme

[code]

try{
sessions = cdb.Config().buildSessionFactory();
session = sessions.openSession(); // open a new Session
}catch(java.lang.Exception exception){log.ecritLigne(exception.toString());}

while (notStop()) {

Shecduler(); //procedure utilisant la même connection

try {
this.sleep(1000);
}
catch (java.lang.Throwable tr) {log.ecritLigne(tr.toString());}

}
[/code]

au bout de quelque minutes le programme executé en dernier envoi l'erreur:

[code]
Exception in thread "Thread-0" org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:50)
at $Proxy0.prepareStatement(Unknown Source)
at smartidebpm.SchedulerBPM.Shecduler(SchedulerBPM.java:87)
at smartidebpm.SchedulerBPM.run(SchedulerBPM.java:55)
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:104)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:236)
at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:94)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
... 5 more
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(BasicResourcePool.java:970)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:208)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:232)
... 8 more

[/code]

même aucun programme utilisant jdbc pour se connecter a cette bd, ne reussi pas a garder sa connection pour longtemp.

je debute avec hibernate, et je ne vois pas du tout l'erreur


merci d'avance pour votre aide


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.