Configuring an HA Datasource with Websphere

Since version 8 of WAS, you can emulate High availability of your Data Sources using Alternate data sources. You can configure alternate data sources by simply adding a custom property named alternateResourceJNDIName to your data source.  This property contains the JNDI name of the alternate data source.

Once configured, a data source and connection factory can fail over and fail back automatically when a specified or default failure threshold value is reached. When fail over occurs, the application switches from using the primary resource to using the alternate resource. Fail back occurs when the application switches back from the alternate resource to the primary resource.

To enable workload routing among data sources, complete the following steps:

1.       Click Resources >JDBC > Data sources and select your desired Data Source.


what is websphere websphere tutorials websphere books websphere datasource

2.       From the data source Additional properties, select the Connection pool properties link.

3.       In the Connection pool properties screen, follow the “Connection pool custom properties” link.

4.       Once in the Connection pool custom properties screen, click New to add a new custom property.

5.       Enter an arbitrary Name for the resource and as Value the JNDI name of your mirror failover Data Source as shown by the following picture:

what is websphere websphere tutorials websphere books websphere datasource

Click Apply and Save your data to the master configuration and repeat the above steps also on your mirrored failover data source to enable failback to the primary data source. Finally, restart the affected application servers.

Francesco Google+