Oracle RAC 的一个负责故障切换处理的主要组件是透明应用程序故障切换 (TAF) 选件。
下面列举通过JDBC实现的透明应用程序故障切换的代码:
//Tele.zhou
Class.forName("oracle.jdbc.driver.OracleDriver");
String url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST =(LOAD_BALANCE = yes)(ADDRESS=(PROTO =TCP)(HOST=node1)(PORT=1521))(ADDRESS=(PROTO =TCP)(HOST=node2)(PORT=1521))(CONNECT_DATA =(SERVICE_NAME = oracleServerName)(failover_mode = (type = select)(method = basic)(retries = 20)(delay = 15)))";
String user="userName";
String password="userPassword";
conn= DriverManager.getConnection(url,user,password);
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/74346/viewspace-1005639/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/74346/viewspace-1005639/