Saturday, 15 March 2014

Weblogic Server JDBC Connect String For Failover and Load Balancing

Weblogic Server Connect String For Failover and Load Balancing


There is a feature of JDBC ( not weblogic ) where you can use your single data source to load balance or failover the requests between different data source nodes ( for example different RAC nodes ), though it's good and easy to configure approach but have few limitations also.


A normal JDBC Connection String is like below 

jdbc:oracle:thin:@localhost:1521:XEDB


A Load-Balanced JDBC Connection String is like below 

jdbc:oracle:thin:@(description=(address_list=
(load_balance=on)
(failover=on)
(address=(protocol=tcp)(host=db1.localhst.com)(port=1521))
(address=(protocol=tcp)(host=db2.localhost.com)(port=1521)))
(connect_data=(service_name=rac_node1)))

A  Failover JDBC Connection String is like below 

jdbc:oracle:thin:@(description=(address_list=
(load_balance=off)
(failover=on)
(address=(protocol=tcp)(host=db1.localhost.com)(port=1521))
(address=(protocol=tcp)(host=db2.localhost.com)(port=1521)))
(connect_data=(service_name=rac_node2)))


Drawback would be - 


Failover would only occur at connect-time, that means during the automatic failover, weblogic will create a new data base connection to the other node instead of using the existing pool connection.

And second drawback is, Global XA transactions are not supported, because there is no guarantee that all of your database transaction involved in a a operation will be direct to the same RAC instance, that would lead some intermittent behavior.

No comments:

Post a Comment