Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 733|回复: 0

Kettle 连接失败 Oracle 数据库报 ora-12505 的解决方法(转)

[复制链接]
  • TA的每日心情
    奋斗
    2024-11-24 15:47
  • 签到天数: 804 天

    [LV.10]以坛为家III

    2053

    主题

    2111

    帖子

    72万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    726782
    发表于 2021-4-27 12:37:23 | 显示全部楼层 |阅读模式

    用kettle新建DB连接的时候总是报错,可是用plsql连接是可以连上,错误信息大致如下:

    错误连接数据库 [MIS] : 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.9.202.67:1521: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.9.202.67:1521:ORCL



        at org.pentaho.di.core.database.Database.normalConnect(Database.java:312)
        at org.pentaho.di.core.database.Database.connect(Database.java:261)
        at org.pentaho.di.core.database.Database.connect(Database.java:223)
        at org.pentaho.di.core.database.Database.connect(Database.java:213)
        at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:55)
        at org.pentaho.di.core.database.DatabaseMeta.testConnection(DatabaseMeta.java:2409)
        at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:487)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:294)
        at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:124)
        at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:112)
        at org.pentaho.ui.xul.swt.tags.SwtButton.access$000(SwtButton.java:17)
        at org.pentaho.ui.xul.swt.tags.SwtButton$1.widgetSelected(SwtButton.java:77)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
        at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
        at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
        at org.eclipse.jface.window.Window.open(Window.java:796)
        at org.pentaho.ui.xul.swt.tags.SwtDialog.show(SwtDialog.java:238)
        at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:161)
        at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.newConnection(SpoonDBDelegate.java:512)
        at org.pentaho.di.ui.spoon.Spoon.newConnection(Spoon.java:6290)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.pentaho.xul.EventHandler.handleMenuEvent(EventHandler.java:42)
        at org.pentaho.xul.swt.menu.PopupMenu.handleMenuEvent(PopupMenu.java:40)
        at org.pentaho.xul.swt.menu.MenuChoice.handleMenuEvent(MenuChoice.java:77)
        at org.pentaho.xul.swt.menu.MenuChoice.handleEvent(MenuChoice.java:73)
        at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
        at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
        at org.pentaho.di.ui.repository.dialog.RepositoryExplorerDialog.open(RepositoryExplorerDialog.java:604)
        at org.pentaho.di.ui.spoon.Spoon.exploreRepository(Spoon.java:2894)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.pentaho.xul.EventHandler.handleMenuEvent(EventHandler.java:42)
        at org.pentaho.xul.swt.menu.MenuBar.handleMenuEvent(MenuBar.java:52)
        at org.pentaho.xul.swt.menu.Menu.handleMenuEvent(Menu.java:117)
        at org.pentaho.xul.swt.menu.MenuChoice.handleMenuEvent(MenuChoice.java:77)
        at org.pentaho.xul.swt.menu.MenuChoice.handleEvent(MenuChoice.java:73)
        at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
        at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
        at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:945)
        at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:5574)
        at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:412)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.pentaho.commons.launcher.Launcher.main(Launcher.java:116)
    Caused by: org.pentaho.di.core.exception.KettleDatabaseException:
    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.9.202.67:1521:ORCL


        at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:435)
        at org.pentaho.di.core.database.Database.normalConnect(Database.java:296)
        ... 61 more
    Caused by: java.sql.SQLException: 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.9.202.67:1521:ORCL

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:420)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:430)
        ... 62 more

    主机名       : 10.9.202.67
    端口           : 1521
    数据库名:ORCL

    查找资料得知:

    jdbc连接数据库的时候,需要使用数据库的sid_name,而不是数据库的services_name
    而使用plsql连接数据库的时候,只需要数据库的services_name即可,所以修改连接字符串中的services_name (即连接参数中的database name)为sid_name

    PS:查看数据库的sid_name语句:

    select INSTANCE_NAME from v$instance;

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2025-1-22 21:01 , Processed in 0.079334 second(s), 29 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表