JAVA EXAMPLE PROGRAMS

JAVA EXAMPLE PROGRAMS

Publish Your Article Here

How to configure database failover and high availability in JBoss 7 Datasource?


If we are configuring our application for high availability and disaster recover, it is mandatory to have failover configurations at DB datasource level as well. In this page, we described how to configure database failover in JBoss 7. Close watch below JBoss datasource configurations. The "connection-url" tag contains two connection urls with a delimiter "|". The delimiter character also required to mention with "url-delimiter" tag.

With this failover configuration, JBoss connects to the first specified DB. On any failure, JBoss tries to connect to second DB url.

<datasource jndi-name="java:jboss/jdbc/HADatasource" pool-name="HADatasource" 
												enabled="true" use-java-context="true">
	<connection-url>
		jdbc:oracle:thin:@db-host:db-port/service|jdbc:oracle:thin:@db-host:db-port/service
	</connection-url>
	<url-delimiter>|</url-delimiter>
	<driver>oracle</driver>
	<security>
		<user-name>user-name</user-name>
		<password>password</password>
	</security>
</datasource>
<< Previous Program 

JBoss configuration examples

  1. How to start/stop JBoss AS 7 in standalone mode?
  2. How to load external property file in JBoss 7 classpath?
  3. How to configure Data Source (JDBC Connection Pool) in JBoss AS 7 standalone mode?
  4. How to configure database failover and high availability in JBoss 7 Datasource?
Knowledge Centre
wait Vs sleep methods
sleep(): It is a static method on Thread class. It makes the current thread into the "Not Runnable" state for specified amount of time. During this time, the thread keeps the lock (monitors) it has acquired.

wait(): It is a method on Object class. It makes the current thread into the "Not Runnable" state. Wait is called on a object, not a thread. Before calling wait() method, the object should be synchronized, means the object should be inside synchronized block. The call to wait() releases the acquired lock.
Famous Quotations
When I do good, I feel good; when I do bad, I feel bad, and that is my religion.
-- Abraham Lincoln

About Author

I'm Nataraja Gootooru, programmer by profession and passionate about technologies. All examples given here are as simple as possible to help beginners. The source code is compiled and tested in my dev environment.

If you come across any mistakes or bugs, please email me to [email protected].

Most Visited Pages

Other Interesting Sites

Reference: Java™ Platform Standard Ed. 7 - API Specification | Java™ Platform Standard Ed. 8 - API Specification | Java is registered trademark of Oracle.
Privacy Policy | Copyright © 2022 by Nataraja Gootooru. All Rights Reserved.