3 Replies Latest reply on Jan 22, 2014 3:00 AM by erasmomarciano

    Connection to h2 drops after 1/2 hour of inactivity

    lfph

      Hello everybody,

       

      I have a problem with a h2 defined as JNDI resource in JBoss. When I run my application it connects perfectly to the h2. However if I do not use the app during approximately 1/2 hour then I am not able to connect the database again

      I get the following error:

       

      Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/jdbc/ORA_BQWJB001

        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:147)

        at com.bbva.elara.dao.JndiDataSource.getConnection(JndiDataSource.java:53)

        at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:123)

        ... 201 more

      Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/jdbc/ORA_BQWJB001

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:390)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:302)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)

        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)

        ... 203 more

       

      My resource is defined as follows:

                  <datasources>

                      <datasource jta="false" jndi-name="java:/jdbc/ORA_BQWJB001" pool-name="QWJB2" enabled="true" use-ccm="false">

                          <connection-url>jdbc:h2:mem:elara;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=RUNSCRIPT FROM 'D:/ENTORNO_LOCAL_APX/dirBaseEjecucion/qwjb/online/multipais/multicanal/sql/QWJB_DDL.sql'</connection-url>

                          <driver>h2</driver>

                          <pool>

                              <min-pool-size>10</min-pool-size>

                              <max-pool-size>20</max-pool-size>

                              <prefill>true</prefill>

                          </pool>

                          <security>

                              <user-name>admin</user-name>

                              <password>admin</password>

                          </security>

                      </datasource>

       

      Does anybody the reason for that behaviour? Or is there a way to define a keep alive time in order not to shut down the connection after a time?

       

      Thank you very much in advance!