Reputation: 950
I have a product that uses Wildfly datasource to connect to Oracle DB. Our Database servers have a scheduled weekly cold backup and for this reason the DB will shutdown every week for approx 10 mins. Then i am forced to restart the application after the DB is started.
How do i configure my Wildfly datasource to check and reconnect after the db is started ?
Wildfly version: wildfly-8.2.0.Final
Data source configuration -
<datasource jndi-name="java:/REQUESTDS" pool-name="REQUESTDS" enabled="true">
<connection-url>jdbc:oracle:thin:@localhost:1521:MYDB</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<connection-property name="selectMethod">
direct
</connection-property>
<connection-property name="sendStringParametersAsUnicode">
true
</connection-property>
<driver>oracle-thin</driver>
<new-connection-sql>SELECT 1 FROM DUAL</new-connection-sql>
<pool>
<min-pool-size>20</min-pool-size>
<max-pool-size>80</max-pool-size>
<prefill>true</prefill>
<use-strict-min>true</use-strict-min>
</pool>
<security>
<security-domain>CompanySecureDataSource</security-domain>
</security>
<validation>
<validate-on-match>true</validate-on-match>
</validation>
<timeout>
<blocking-timeout-millis>90000</blocking-timeout-millis>
<allocation-retry>40</allocation-retry>
<allocation-retry-wait-millis>30000</allocation-retry-wait-millis>
</timeout>
</datasource>
I have checked my threads here and tried most of them. But in vain.
What is the correct setting that will check and reconnect to oracle db
Upvotes: 0
Views: 2816
Reputation: 4433
Using background-validation
and the pool will try to create new connections if any one of them dies.
<validation>
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>true</background-validation>
<background-validation-millis>20000</background-validation-millis>
</validation>
Upvotes: 1