2 Replies Latest reply on Jan 20, 2012 8:34 AM by jesper.pedersen

    Remove idle connection in jboss 7.0.2

    varsha.g

      I am using the hibernate connection pooling in my application here is cofiguration..

       

           <property name="hibernate.connection.release_mode">on_close</property>        

               <property        name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>       

              <property name="hibernate.c3p0.acquire_increment">1</property>

              <property name="hibernate.c3p0.idle_test_period">60</property>

              <property name="hibernate.c3p0.min_size">1</property>

              <property name="hibernate.c3p0.max_size">35</property>

              <property name="hibernate.c3p0.max_statements">50</property>

              <property name="hibernate.c3p0.timeout">0</property>

              <property name="hibernate.c3p0.acquireRetryAttempts">1</property>

              <property name="hibernate.c3p0.acquireRetryDelay">250</property>

       

        when i deploy the war, 'n' number of connections are established according to the connection pool setting. while redeploying the new war it keeps the old database connections as well as again established new connections.

       

      If i deploy the war after restarting the server than it will delete all old db connection and will establish only new connections.

       

      how to prevent this (i.e. only establish new connections, no old connection should exist ) without restarting the server?

        • 1. Re: Remove idle connection in jboss 7.0.2
          sfcoy

          To quote the Hibernate documentation:

          For use inside an application server, you should almost always configure Hibernate to obtain connections from an application server javax.sql.Datasource registered in JNDI.

           

          What you're trying to do here smells a bit. It kind of defeats one of the main purposes of using a connection pool.

           

          Are you by any chance trying to force your database transactions to commit?

           

          Maybe we can find a better way to achieve what you're trying to do.

          • 2. Re: Remove idle connection in jboss 7.0.2
            jesper.pedersen

            Use 7.1.0.CR1b