1.kettle 5.4 使用JDBC连接的时候报错(测试不同的数据库,发现只是连接11gRAC 的时候会报JDBC的错误)

具体报错如下

java.sql.SQLException: 建数据库连接出现异常:

oracle.jdbc.driver.OracleDriver

jdbc:oracle:thin:@90.12.xx.xx:1521:orcl

ORCL_CON

Listener refused the connection with the following error:

ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

The Connection descriptor used by the client was:

90.12.xx.xx:1521:orcl

使用sqlplus 进一步测定发现数据库功能正常,尝试其他的连接方式。

2.尝试用ODBC的方式连接:

管理工具-->数据源--用户DSN--添加--选择oracle驱动

在kettle上配置ODBC连接 测试OK!

3.尝试OCI的连接方式报错如下:

错误连接数据库 [Source_Db] : org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred while trying to connect to the database Error connecting to database: (using class oracle.jdbc.driver.OracleDriver)
no ocijdbc11 in java.library.path org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred while trying to connect to the database Error connecting to database: (using class oracle.jdbc.driver.OracleDriver)
no ocijdbc11 in java.library.path at org.pentaho.di.core.database.Database.normalConnect(Database.java:428)
at org.pentaho.di.core.database.Database.connect(Database.java:358)
at org.pentaho.di.core.database.Database.connect(Database.java:311)
at org.pentaho.di.core.database.Database.connect(Database.java:301)
at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:80) 主机名 :
端口 : 1521
数据库名:orcl

4.google 了一下采取以下方案解决:

在环境变量中设置:

ORACLE_HOME=D:\app\gssjcj\product\11.2.0\dbhome_1
TNS_ADMIN=D:\app\gssjcj\product\11.2.0\dbhome_1\NETWORK\ADMIN
PATH=%ORACLE_HOME%\BIN;%PATH% tnsnames.ora contains:
J3_CX =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 90.xx.xx.xx)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
) Copied OCIJDBC11.dll to the libswt\win64

配置OCI连接:

测试OK!

之后在http://community.pentaho.com/看到如下描述:

OCI

OCI uses the Oracle client installed on the client you're currently using. If you are using OCI and an Oracle Net8 client, the JDBC driver version used in Kettle needs to match your Oracle client version. PDI 2.5.0 shipped with version 10.1, 3.0.0 ships with version 10.2. You can either install that version of the Oracle client or change the JDBC driver in PDI if versions don't match up.

This is how you change the Oracle JDBC driver in Kettle. Replace files "ojdbc14.jar" and "orai18n.jar" in the directory libext/JDBC of your distribution with the files found in the $ORACLE_HOME/jdbc directory on your server or if the versions are different, with the JDBC driver that matches your Net8 client. For Oracle 11g the drivers are named ojdbc5.jar and ojdbc6.jar.

If you still have issues please remember that the DLL that Oracle uses to connect has to be in your path. If all else fails, try copying the ocijdbc10.dll (might be called different in different versions) to the libswt/win32 folder (or win64).

RAC (Real Application Cluster)

When dealing with a Real Application Cluster or other complex failover oracle situations, please define the connection like this:

·         * Set to native (JDBC) connection type

·         * Leave hostname and port empty (this is also working with a port setting of -1)

·         * Set the database name to something like this...
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = host1-vip)(PORT =
1521))(ADDRESS = (PROTOCOL = TCP)(HOST = host2-vip)(PORT = 1521))(LOAD_BALANCE
= yes)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME =
db-service)(FAILOVER_MODE =(TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY
= 5))))

or
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=PRIMARY_NODE_HOSTNAME)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=SECONDARY_NODE_HOSTNAME)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=DATABASE_SERVICENAME)))

or
(DESCRIPTION=(FAILOVER=ON)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxx)(PORT=1526))(ADDRESS=(PROTOCOL=TCP)(HOST=xxxx)(PORT=1526)))(CONNECT_DATA=(SERVICE_NAME=somesid)))

Note: This does only work with a
repository based system until 3.0.4. Beginning with 3.0.5 and 3.1 file based
systems do also support this.

最新文章

  1. 【leetcode】ZigZag Conversion
  2. bzoj 4553 && HEOI2016 day1t3 seq
  3. listview和checkbox的冲突的用法
  4. Model元数据定制与Model模板
  5. 算法手记 之 数据结构(并查集详解)(POJ1703)
  6. c#获取url请求的返回值(转)
  7. 使用PowerShell简化我的工作
  8. Java 获取APK安装程序的包名
  9. 搭建nodejs环境推荐用两个工具:nvm和npm
  10. Eclipse扩展点实践之添加菜单项(ActionSet方式实现)
  11. centos安装wget 及配置(转)
  12. DevExpress.XtraReports.UI.XtraReport 动态报表
  13. poj 1088 滑雪(贪心算法)
  14. Java版权信息之Jautodoc
  15. cookie 与 session
  16. 从源码浅析Java中的Lock和AbstractQueuedSynchronizer
  17. mapreduce shuffle 和sort 详解
  18. (二叉树 DFS 递归) leetcode 112. Path Sum
  19. UML作业第一次:UML用例图绘制
  20. table中内容过长,table改变的问题

热门文章

  1. Python:内置函数zip()
  2. TModJS:README
  3. PG degraded实验
  4. Java中“分号”引起的陷阱
  5. 多对多 hibernate映射
  6. ansible一键部署LAMP
  7. hbase->Mapreduce->hbase
  8. \阶段4-独挡一面\项目-基于视频压缩的实时监控系统\Sprint2-采集端图像采集子系统设计
  9. 使用Cors后台设置WebAPI接口跨域访问
  10. 19.Imagetragick 命令执行漏洞(CVE-2016–3714)