KettleDataBaseException ,ETL连接数据库失败ora-12505解决方法

本文解决了一个常见的数据库连接问题:使用JDBC连接Oracle数据库时出现的ORA-12505错误。该错误提示监听器不知道连接描述符中给出的SID。文章详细解释了此错误的原因,并提供了如何正确配置连接字符串来解决问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述:
数据库迁移之后,ETL(数据同步工具)工具连接oracle时,选用jdbc 连oracle数据库的时候出现了ora-12505错误:

错误如下:

数据库 [orcl] : org.pentaho.di.core.exception.KettleDatabaseException: 
Error occured while trying to connect to the database

Error connecting to database: (using class oracle.jdbc.driver.OracleDriver)
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:
10.10.88.90:1521:DBDMS

org.pentaho.di.core.exception.KettleDatabaseException: 
Error occured while trying to connect to the database

Error connecting to database: (using class oracle.jdbc.driver.OracleDriver)
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:
10.10.88.90:1521:DBDMS

 

---------

而直接通过plsql可以正常连接数据库,或者可以通过sqlplus 连接数据库

经过debug和查找相关的资料发现问题原因如下:
jdbc连接数据库的时候,需要使用数据库的sid_name,而不是数据库的services_name
而使用plsql连接数据库的时候,只需要数据库的services_name即可,所以修改连接字符串中的services_name (即连接参数中的database name)为sid_name

附:
查看数据库中当前的sid:

SQL> select INSTANCE_NAME from v$instance;

INSTANCE_NAME
----------------
orcl2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值