4 Replies Latest reply on Sep 29, 2006 10:43 AM by weston.price

    Datasource connection timeout

    ben_ben

      Hi,

      We're using pooled database connections through JBoss 4 connecting to an Ingres database. Everything works fine when the system first starts up, connections successfully contact the database and get reused via the connection pool. However...

      ...when the system is left alone for a reasonable length of time (e.g. 4-5 hours) the next use of a database connection times out, leaving a broken connection which is then returned to the pool. We've changed the datasource configuration to validate connections it gets out of the pool so that the system can continue to run, but we can't work out why the time-outs occur. We've also connected from a stand alone application using the same jdbc driver class to our database (i.e. bypassing JBoss) and the connections can be used and left alone with no problems at all, which leads us to think it's a datasource configuration problem.

      Has anyone got any ideas?

      Thanks

      Ben


      Datasource configuration:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <datasources>
      
       <local-tx-datasource>
       <jndi-name>ingresDS</jndi-name>
       <!-- connection url -->
       <connection-url>jdbc:edbc://server:DV7/database</connection-url>
       <!-- auto commit -->
       <connection-property name="autocommit_mode">single</connection-property>
       <!-- only lock on non-read -->
       <transaction-isolation>TRANSACTION_READ_UNCOMMITTED</transaction-isolation>
       <!-- sql to run when new connections are created, doubly make sure locking isn't on -->
       <new-connection-sql>set lockmode session where readlock = nolock</new-connection-sql>
       <!-- jdbc driver class -->
       <driver-class>ca.edbc.jdbc.EdbcDriver</driver-class>
       <!-- minimum connection pool size -->
       <min-pool-size>5</min-pool-size>
       <!-- maximum connection pool size -->
       <max-pool-size>30</max-pool-size>
       <!-- timeout for idle connections -->
       <idle-timeout-minutes>0</idle-timeout-minutes>
       <!-- security domain name -->
       <security-domain>ingres</security-domain>
       <!-- test for stale connections -->
       <check-valid-connection-sql>select count(*) from table</check-valid-connection-sql>
       </local-tx-datasource>
      
      </datasources>