赞
踩
转自:http://blog.163.com/wenming_126@126/blog/static/19654138200722675655592/
只需在url处改为
jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = hostIp1)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = hostIp2)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = hostIp3)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = serviceName)))
即可
URL="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.48.105)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.48.105)(PORT=1522))(FAILOVER=yes)(LOAD_BALANCE=no)(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=RACDB)))"
An example of the connection pools, a WebLogic JDBC MultiPool, and an associated data source in the
config.xml
file would be:
CapacityIncrement="1"
ConnLeakProfilingEnabled="true"
CountOfTestFailuresTillFlush="1"
DriverName="oracle.jdbc.xa.client.OracleXADataSource"
InitialCapacity="5"
KeepXAConnTillTxComplete="true"
MaxCapacity="100"
Name="jdbcXAPool1"
PasswordEncrypted="{3DES}lBifoTsg8fc="
Properties="user=wlsqa"
RefreshMinutes="1" SupportsLocalTransaction="true"
Targets="WLSCluster"
TestConnectionsOnReserve="true"
TestTableName="dual"
URL="jdbc:oracle:thin:@db_server1:1521:SNRAC1"
XAEndOnlyOnce="true"
XARetryDurationSeconds="300"
XASetTransactionTimeout="true"/>
XATransactionTimeout="302"/>
CapacityIncrement="1"
ConnLeakProfilingEnabled="true"
CountOfTestFailuresTillFlush="1"
DriverName="oracle.jdbc.xa.client.OracleXADataSource"
InitialCapacity="5"
KeepXAConnTillTxComplete="true"
MaxCapacity="100"
Name="jdbcXAPool2"
PasswordEncrypted="{3DES}lBifoTsg8fc="
Properties="user=wlsqa"
RefreshMinutes="1"
SupportsLocalTransaction="true"
Targets="WLSCluster"
TestConnectionsOnReserve="true"
TestTableName="dual"
URL="jdbc:oracle:thin:@db_server2:1521:SNRAC2"
XAEndOnlyOnce="true"
XARetryDurationSeconds="300"
XASetTransactionTimeout="true"/>
XATransactionTimeout="302"/>
Name="jdbcXAMultiPool1"
PoolList="jdbcXAPool1,jdbcXAPool2"
Targets="WLSCluster"
AlgorithmType="Load-Balancing"/>
JNDIName="jdbcXADataSource1"
Name="jdbcXADataSource1"
PoolName="jdbcXAMultiPool1"
Targets="WLSCluster"/>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。