Disconnected after data source indefinite period (workaround: Set to start after connection shutdown, reconnect automatically

Source: Internet
Author: User
Tags failover jboss wildfly

The connection breaks after the data source indefinite period (workaround: Set up since the connection is closed and reconnect automatically.) The question is described below):



The original configuration file of the data source is as follows: (Note: 2 rows of Red line conflict)


The modified data source configuration is as follows: (resolve the problem of indefinite time database connection interruption) (Note:Verify the (partial) effect of the code: when the database connection is disconnected, reconnect automatically。 )                     <validation>     & nbsp                   <valid-connection-checker class-name= Org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker "/>                         <check-valid-connection-sql>select 1 from dual</ check-valid-connection-sql>                        //&LT;V alidate-on-match>false</validate-on-match>                         <background-validation>true</background-validation>                         <background-validation-millis>200000</ background-validation-millis>               &NBSP;         <use-fast-fail>false</use-fast-fail>             &N Bsp           <stale-connection-checker class-name= " Org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker "/>                         <exception-sorter class-name= " Org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter "/>             & nbsp       </validation>
(Supplemental Knowledge) configuration of Wildfly server configuration files in engineeringDual Physical machine data source(Configuration Code): <connection-url>jdbc:oracle:thin:@ (description= (address_list=) (address= (protocol=tcp) (HOST= 10.100.24.30) (port=1521)) (Address= (PROTOCOL=TCP) (host=10.100.24.31) (port=1521)) (Load_balance=yes) (Failover=on) ) (Connect_data= (SERVICE_NAME=ORCL)) </connection-url> The configuration of wildfly server configuration file in the projecta physical machine data source(Configuration Code): < Connection-url > JDBC:ORACLE:THIN:@192.168.2.231:1521:ORCL </connection-url > (Note: When deploying a project, the database is deployed on multiple physical machines to prevent a database physical machine from hanging the impact project, when the database is deployed on multiple physical machines, you can create a virtual machine database to associate multiple physical machine databases so that only one IP connection is required in the server's data source connection configuration file.the entire data source configuration code is as follows (Dual Physical machine configuration):           <datasources>               & nbsp <datasource jta= "true" Jndi-name= "Java:jboss/datasources/oracleds_uam" pool-name= "Oracleds_uam" enabled= "true" Use-java-context= "true" use-ccm= "true" >                     <conne ction-url>jdbc:oracle:thin:@ (description= address_list= (address= (protocol=tcp) (HOST=10.100.24.30) (PORT=1521 ) (Address= (PROTOCOL=TCP) (host=10.100.24.31) (port=1521)) (Load_balance=yes) (Failover=on)) (Connect_data= (SERVICE _NAME=ORCL)) </connection-url>                     &LT;DRIVER-CLA ss>oracle.jdbc.driver.oracledriver</driver-class>                     <driver>oracle</driver>                     &L t;pool>             &NBSP;           <min-pool-size>10</min-pool-size>           &NBSP ;             <max-pool-size>100</max-pool-size>         &NBS P               <prefill>true</prefill>           &N Bsp             <use-strict-min>false</use-strict-min>                         <flush-strategy>failingconnectiononly</flush-strategy >                     </pool>         &NBSP ;           <security>                         <user-name>sdsy</user-name>                   &NBSP ;     <password>sdsy1qaz@wsx.</password>                     </ security>                 <validation>     & nbsp                   <valid-connection-checker class-name= Org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker "/>                         <check-valid-connection-sql>select 1 from dual</ check-valid-connection-sql>                         &LT;BAC kground-validation>true</background-validation>                         <background-validation-millis>200000</background-validation-millis>                       &NBSP <use-fast-fail>false</use-fast-fail>                     &N Bsp   <stale-connection-checker Class-name= " Org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker "/>                         <exception-sorter class-name= " Org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter "/>             & nbsp       </validation>                 </datasource> &nbsp ;               <drivers>                &N Bsp     <driver name= "Oracle" module= "Com.oracle" >                 &NB Sp       <xa-datasource-class>oracle.jdbc.xa.client.oraclexadatasource</xa-datasource-class >   &nbsp                 </driver>               & nbsp </drivers>      </datasources>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.