2 Replies Latest reply on Aug 26, 2013 12:09 PM by Jesper Pedersen

    JBoss EAP datasource background-validation

    Darrell Burgan Newbie

      Sorry if this is the wrong forum, but I'm not sure where to ask this. We're using JBoss EAP 6.0.1 as our production application server and MS SQL Server 2008R2 as the database server. Also using the latest MS JDBC driver. I'm trying to get datasource validation working right, and having some trouble.

       

      We need validation because our SQL Server cluster, when it fails over from one physical machine to another, abandons all existing database connections and expects the application to reconnect. I won't get started as to what I think of that design, but I'll simply say that because of this behavior we must have validation of our connections.

       

      I do have validation working, but here's the issue. No matter what I do, JBoss is validating the connection every time it serves up a connection from the datasource. Given our volume, this causes a meaningful impact to the database server. What I really want is for JBoss to periodically validate idle connections in the background.

       

      This happens both in standalone and in domain mode. Here's a snippet from my standalone.xml:

       

      <datasource jndi-name="java:jboss/datasources/xxx" pool-name="xxx_pool" enabled="true" use-java-context="true" use-ccm="true" jta="false">

        <connection-url>jdbc:sqlserver://xxx:1433;DatabaseName=xxx</connection-url>

        <transaction-isolation>TRANSACTION_READ_UNCOMMITTED</transaction-isolation>

        <driver>mssql</driver>

        <pool>

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

           <max-pool-size>300</max-pool-size>

           <prefill>true</prefill>

        </pool>

        <security>

           <user-name>xxx</user-name>

           <password>xxx</password>

        </security>

        <timeout>

           <idle-timeout-minutes>0</idle-timeout-minutes>

        </timeout>

        <validation>

           <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>

           <background-validation>true</background-validation>

           <validate-on-match>false</validate-on-match>

           <background-validation-millis>60000</background-validation-millis>

           <use-fast-fail>true</use-fast-fail>

        </validation>

      </datasource>

       

      I've tried a great variety of permutations on this configuration, including using the JBoss adapter class to do the validation instead of explicitly saying "SELECT 1", and also omitting the <timeout> and <use-fast-fail> tags, but no behavior change.

       

      What am I doing wrong?  Help!   :-)

       

      Thanks,

      Darrell Burgan