-->
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.  [ 5 posts ] 
Author Message
 Post subject: Probleme avec l'autoReconnect.
PostPosted: Mon Oct 17, 2005 7:40 am 
Newbie

Joined: Fri Aug 05, 2005 5:35 am
Posts: 5
Bonjour,
J'ai un souci depuis plusieurs jours, et j'ai beau cherché partout, je ne vois pas ce que je fais de mal. J'ai une BD Mysql, et j'accede aux données depuis mes servlets via hibernate.
Mon problème est qu'au bout d'un certain temps, (défni par la variable active_timeout) ma connection se coupe. J'utilise donc pour contrecarrer ca un pool de connexion courant (le common DBCP ) et j'ai spécifié dans mes parametres d'url pour ma BD l'option autoReconnect=true.
Pourtant rien n'y fait, je n'arrive pas a me reconnecter, et je commence a m'arracher les cheveux la dessus!
Quelqu'un aurait une piste pour moi?

J'utilise un tomcat 5.5.9, Mysql 4.1.14, et hibernate 3.0.5, le tout sur une debian.

Merci d'avance pour toute aide!

PS: A tout hasard, je joint mon fichier de mapping hirbernate
Code:
<hibernate-configuration>

    <session-factory>
        <!-- Database connection settings -->
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost:3306/site?autoReconnect=true</property>
        <property name="connection.username">...</property>
        <property name="connection.password">...</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">5</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

        <property name="show_sql">false</property>

      <!--### Apache DBCP Connection Pool ###-->
      <!--connection pool-->
      <property name="hibernate.dbcp.maxActive">10</property>
      <property name="hibernate.dbcp.whenExhaustedAction">1</property>
      <property name="hibernate.dbcp.maxWait">2000</property>
      <property name="hibernate.dbcp.maxIdle">2</property>

      <!-- prepared statement cache-->
      <property name="hibernate.dbcp.ps.maxActive">10</property>
      <property name="hibernate.dbcp.ps.whenExhaustedAction">1</property>
      <property name="hibernate.dbcp.ps.maxWait">2000</property>
      <property name="hibernate.dbcp.ps.maxIdle">10</property>

      <!-- optional query to validate pooled connections:-->
      <property name="hibernate.dbcp.validationQuery">select 1</property>
      <property name="hibernate.dbcp.testOnBorrow">true</property>
      <property name="hibernate.dbcp.testOnReturn">true</property>

     
-- Mapping ... ---

    </session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 17, 2005 11:22 am 
Newbie

Joined: Fri Aug 05, 2005 5:35 am
Posts: 5
Je n'ai pas trouvé de reelle solution avec ma configuration, mais j'ai fini par passer sour c3p0, plutot que DBCP d'Apache.
Et ca marche!
Par curiosité, si quelqu'un avait une explication a me donner sur mon problème initial, je serais preneur, car les perfs n'ont pas l'air d'etre aussi interessante qu'avec DBCP (quand ca marcahit ;) )


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 12:10 am 
Newbie

Joined: Wed Oct 12, 2005 9:20 pm
Posts: 16
Location: Sydney
Bonjour,

Je suis debutant, mais les problemes des autres me permettent de progresser.

En regardant la doc, ils parlent de "remplacement de la propriete hibernate.connection.pool_size" ,

Quote:
Hibernate's own connection pooling algorithm is however quite rudimentary. It is intended to help you get started and is not intended for use in a production system or even for performance testing. You should use a third party pool for best performance and stability. Just replace the hibernate.connection.pool_size property with connection pool specific settings. This will turn off Hibernate's internal pool. For example, you might like to use C3P0.


Bon, j'avoue que c'est pas sur, mais si tu laisses cette propriete dans le fichier de mapping, ca n'ecrase pas la configuration du pool que tu fais par le suite ?

Par ailleurs, si ca n'est pas ca, ca m'interesse aussi de savoir pourquoi.


Ben


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 4:54 am 
Newbie

Joined: Fri Aug 05, 2005 5:35 am
Posts: 5
Ah! Ca me paraissait une très bonne raison, mais apres test, ca ne change rien à mon ancien comportement (la définition des blocs qui suivent doivent "ecraser" l'utilisation du pool de test. Tant pis!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 5:48 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
essaie C3PO

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.