Search code examples
oracle-databasejbossconnection-poolingreconnect

Is there any way to have the JBoss connection pool reconnect to Oracle when connections go bad?


We have our JBoss and Oracle on separate servers. The connections seem to be dropped and is causing issues with JBoss. How can I have the JBoss reconnect to Oracle if the connection is bad while we figure out why the connections are being dropped in the first place?


Solution

  • There is usually a configuration option on the pool to enable a validation query to be executed on borrow. If the validation query executes successfully, the pool will return that connection. If the query does not execute successfully, the pool will create a new connection.

    The JBoss Wiki documents the various attributes of the pool.

    <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
    

    Seems like it should do the trick.