配置连接池连接Oarcle RAC集群

来源:互联网 发布:tensorflow能用java吗 编辑:程序博客网 时间:2024/06/10 10:39


转自: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)))"

Sample config.xml Code

An example of the connection pools, a WebLogic JDBC MultiPool, and an associated data source in the

config.xml

file would be:

<JDBCConnectionPool

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"/>

<JDBCConnectionPool

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"/>

<JDBCMultiPool

Name="jdbcXAMultiPool1"

PoolList="jdbcXAPool1,jdbcXAPool2"

Targets="WLSCluster"

AlgorithmType="Load-Balancing"/>

<JDBCTxDataSource

JNDIName="jdbcXADataSource1"

Name="jdbcXADataSource1"

PoolName="jdbcXAMultiPool1"

Targets="WLSCluster"/>


原创粉丝点击