标签:cas data failover count http time ref ack mic
完全正确
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=OFF)(FAILOVER=ON) (ADDRESS=(PROTOCOL=TCP)(HOST=tst-db1.myco.com)(PORT=1604)) (ADDRESS=(PROTOCOL=TCP)(HOST=tst-db2.myco.com)(PORT=1604))) (CONNECT_DATA=(SERVICE_NAME=mydb1.myco.com)(SERVER=DEDICATED)))
官方文档, 一如既往地冗长, 可靠
https://docs.oracle.com/database/121/HABPT/config_fcf.htm#HABPT5381
PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource(); pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource"); pds.setUser("system"); pds.setPassword("oracle"); String dbURL = "jdbc:oracle:thin:@" + "(DESCRIPTION=" + "(FAILOVER=on)" + "(ADDRESS_LIST=" + "(LOAD_BALANCE=on)" + "(CONNECT_TIMEOUT=3)(RETRY_COUNT=3)" + "(ADDRESS=(PROTOCOL=TCP)(HOST=prmy-scan)(PORT=1521))"+ "(ADDRESS=(PROTOCOL=TCP)(HOST= stby-scan)(PORT=1521)))" + "(CONNECT_DATA=(SERVICE_NAME=oltpworkload)))" System.out.println("Url=" + dbURL); pds.setURL(dbURL);
"jdbc:oracle:thin:@" + "(DESCRIPTION=" + "(FAILOVER=on)" + "(ADDRESS_LIST=" + "(LOAD_BALANCE=on)" + "(CONNECT_TIMEOUT=3)(RETRY_COUNT=3)" + "(ADDRESS=(PROTOCOL=TCP)(HOST=prmy-scan)(PORT=1521))"+ "(ADDRESS=(PROTOCOL=TCP)(HOST= stby-scan)(PORT=1521)))" + "(CONNECT_DATA=(SERVICE_NAME=oltpworkload)))"
PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource(); pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource"); pds.setUser("system"); pds.setPassword("oracle"); String dbURL = "jdbc:oracle:thin:@" + "(DESCRIPTION_LIST=" + "(LOAD_BALANCE=off)" + "(FAILOVER=on)" + "(DESCRIPTION=" + "(CONNECT_TIMEOUT=3)(RETRY_COUNT=3)" + "(ADDRESS_LIST=" + "(LOAD_BALANCE=on)" + "(ADDRESS=(PROTOCOL=TCP)(HOST=prmy-scan)(PORT=1521)))" + "(CONNECT_DATA=(SERVICE_NAME=oltpworkload)))" + "(DESCRIPTION=" + "(ADDRESS_LIST=" + "(LOAD_BALANCE=on)" + "(ADDRESS=(PROTOCOL=TCP)(HOST= stby-scan)(PORT=1521)))" + "(CONNECT_DATA=(SERVICE_NAME=oltpworkload))))"; System.out.println("Url=" + dbURL); pds.setURL(dbURL);
这个第三方总结很简单, 看样子是第三方驱动厂商
https://support.tibco.com/s/article/JDBC-dbURL-when-using-failover-servers-with-Oracle
jdbc:tibcosoftwareinc:oracle://<myhost1>:<myport1>SID=<myservice1>AlternateServers=(<myhost2>:<myport2>SID=<myservice2>)
jdbc:tibcosoftwareinc:oracle://host1:1521;ServiceName=orcl;AlternateServers=(host2:1521)
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<myhost1>)(PORT=<myport1>))(SERVICE_NAME=<myservice1>))(ADDRESS=(PROTOCOL=TCP)(HOST=<myhost2>)(PORT=<myport2>))(LOAD_BALANCE=yes)(CONNECT_DATA=(SERVICE_NAME=<myservice2>)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=180))))
jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=host1) (PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=host2) (PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)))
Oracle RAC JDBC connection string
标签:cas data failover count http time ref ack mic
原文地址:https://www.cnblogs.com/tekikesyo/p/12791755.html