java - Oracle FCF OSN 客户端配置

标签 java oracle10g spring-jdbc ucp

好时光!

首先,这是我的环境:

  • Java 1.7
  • Tomcat 7
  • Oracle UCP 连接池
  • 瘦 JDBC 驱动程序
  • 具有 RAC 和 SCAN 功能的 Oracle 10g 数据库 ( some information )

我需要配置 Oracle FCF 功能。有几篇关于它的配置的文章:Spring documentation (1) , complete example (2) ,...

我已执行文章 (1) 中描述的所有步骤,并且还配置了 UCP 日志记录,可以在其中看到 FCF 实际上已启用。

令我困惑的是第二篇文章的以下陈述:

FAST CONNECTION FAILOVER PREREQUISITES
...

 5.) The JVM in which your JDBC instance is running must have
 * oracle.ons.oraclehome set to point to your ORACLE_HOME. For example:
 * 
 * -Doracle.ons.oraclehome=C:\oracle\product\10.2.0\db_1

...

问题:

我的 Oracle 数据库 (RAC) 位于远程服务器,并且我使用瘦 JDBC 驱动程序,那么我应该在这里做什么(我真的需要设置 uop 这个参数吗?如果是,那么如何设置)?第一篇文章中没有关于配置这样的 JVM 参数的意义,只是说我需要设置数据源的“ONSConfiguration”参数,我应该在其中列出所有 RAC 节点...

更新1:

同样来自第二篇文章:

CLIENT-SIDE ONS CONFIGURATION
...
(2) ONS daemon on the client side
Example ons.config file for a client:
...

本文开头说“客户端”是基于java的应用程序,而“服务器端”是数据库(RAC)。如果使用瘦 JDBC 驱动程序,确实需要在基于 java 的应用程序端创建“ons.config”文件吗?

UDPADE 2: 来自 Oracle documentation :

Remote Configuration

UCP for JDBC supports remote configuration of ONS through the SetONSConfiguration pool property.    The ONS property value is a string that closely resembles the content of an ons.config file. The string contains a list of name=value pairs separated by a new line character (\n). The name can be: nodes, walletfile, or walletpassword. The parameter string should at least specify the ONS configuration nodes attribute as a list of host:port pairs separated by a comma. SSL would be used when the walletfile attribute is specified as an Oracle wallet file.

Applications that use remote configuration must set the oracle.ons.oraclehome system property to the location of ORACLE_HOME before starting the application. For example: java -Doracle.ons.oraclehome=$ORACLE_HOME ...

但是,当我本地没有安装 Oracle 数据库时,如何设置 ORACLE_HOME 变量,这就是瘦驱动程序的作用,对吧?

最佳答案

如果您只想使用 UCP 池,那么您只需要此设置:

PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
pds.setONSConfiguration("nodes=10.247.43.111:4500, 10.247.43.112:4500");
pds.setFastConnectionFailoverEnabled(true);

其中“nodes=10.247.43.111:4500, 10.247.43.112:4500”是 ons listerer 列表

10.247.43.111:4500 - 节点 1 上的远程监听器
10.247.43.112:4500 - 节点 2 上的远程监听器
等等

看看这个很好的例子:

http://www.idevelopment.info/data/Programming/java/jdbc/High_Availability/FastConnectionFailoverExampleThin.java

还有这个http://docs.oracle.com/cd/B19306_01/java.102/b14355/fstconfo.htm#CEGGDDFJ

本地 ONS 恶魔连接需要 ORACLE_HOME。

关于java - Oracle FCF OSN 客户端配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26156322/

相关文章:

java - Objective-C : enum like Java (int values and many others for each enum)

java - 如何使用 WEKA API 学习贝叶斯网络(结构+参数)?

java - 这个spring类BatchPreparedStatementSetter有什么用呢?

Spring 启动-管理交易和多个数据源

c# - 是否可以使用 OleDb 将 Int[] 发送到 Oracle 存储过程

spring - 如何在 spring mvc 3 中使用 jdbcTemplate 返回结果集的预准备语句?

java - 如何使用 Maven 在 Vaadin 7 中只编译必要的小部件?

java - 如何将碰撞盒置于旋转三角形 Sprite 内的中心?

sql - 如何在oracle的emp表中找到前三名最高工资?

oracle10g - Oracle错误ORA-22905 : cannot access rows from a non-nested table item