Community

Problem of jboss server starting on connection failover

reply from Samarjit Chakraborty in Datasource Configuration - View the full discussion

Dear Priyanka,

 

I've got this reference from http://community.jboss.org/wiki/JBossJCADatabaseFailover

 

In JBoss v5.0.x or greater <ha-local-tx-datasource> elements are no longer supported. Instead of that you can put the <connection-url> separated by delimiters in your main <local-tx-datasource> element inside *-ds.xml. Even <url-delimiter> can be included inside.

 

I've tested it using this configuration:

 

<datasources>
   <local-tx-datasource>  
      <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
      <!-- Datasources are not available outside the virtual machine -->
      <jndi-name>OracleDS</jndi-name>
      <connection-url>jdbc:oracle:thin:@localhost:1521:orcl|jdbc:oracle:thin:@localhost:1521:study</connection-url>
      <url-delimiter>|</url-delimiter>
      <!-- The driver class -->
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>     
      <!-- The login and password -->
      <user-name>xxx</user-name>
      <password>yyy</password>     
      <min-pool-size>5</min-pool-size>
      <!-- The maximum connections in a pool/sub-pool -->
      <max-pool-size>20</max-pool-size>
      <!-- The time before an unused connection is destroyed -->
      <idle-timeout-minutes>0</idle-timeout-minutes>     
      <!-- Whether to check all statements are closed when the connection is returned to the pool,
           this is a debugging feature that should be turned off in production -->
      <track-statements/>     
      <!-- Benefits from prepared statement caching -->
      <prepared-statement-cache-size>32</prepared-statement-cache-size>     
      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
      <metadata>
         <type-mapping>Oracle9i</type-mapping>
      </metadata>     
   </local-tx-datasource>
</datasources>

 

And it is working. When i stopped the instance of database representing "url1" JBoss automatically bound the JNDI name to "url2". Please check it out.

 

Let me know whether you succeeded or not.

 

Best of luck

 

Samarjit

Reply to this message by going to Community

Start a new discussion in Datasource Configuration at Community