www.Orasql.Com
 
用户名: 密码:  验证码: 注册|找回密码 oracleawen's blog  
 
         当前位置 >> 技术论坛  发表帖子     论坛版块     查找帖子
应用程序的JDBC连接Oracle RAC-技术论坛||Oracle高手之路—Orasql.Com!
            应用程序的JDBC连接Oracle RAC
 
发贴人:oracle_awen
oracleawen@gmail.com448315233127.0.0.1
用户级别:管理员
发贴总数:1245
注册时间:2011-05-05 09:23:03
2011-12-31 12:44:01


JDBC连接Oracle只需要将connString 的内容修改就可以,具体的配置文件如下

[root@rac1 bin]# vim /usr/tomcat/webapps/shop/WEB-INF/classes/javabean/dbconn.properties

driverName=oracle.jdbc.driver.OracleDriver
connString=jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = rac2)(PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = ON)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = myorc.oracle.com)))
userName=scott
password=oracle

SERVICE_NAME   为全局数据库服务名 我的ORACLE_SID为myorc
重启tomcat,然后再测试是否配置成功
[root@rac1 bin]# ./shutdown.sh
Using CATALINA_BASE:   /usr/tomcat
Using CATALINA_HOME:   /usr/tomcat
Using CATALINA_TMPDIR: /usr/tomcat/temp
Using JRE_HOME:        /usr/java/jdk1.6.0_30
Using CLASSPATH:       /usr/tomcat/bin/bootstrap.jar
[root@rac1 bin]# ./startup.sh
Using CATALINA_BASE:   /usr/tomcat
Using CATALINA_HOME:   /usr/tomcat
Using CATALINA_TMPDIR: /usr/tomcat/temp
Using JRE_HOME:        /usr/java/jdk1.6.0_30
Using CLASSPATH:       /usr/tomcat/bin/bootstrap.jar

 

      
 
  
 Orasql.Com|E-Mail:oracleawen@gmail.com|Phone:15271942915|Copyright © 2011|All Rights Reserved|