开发反馈使用kettle工具连pdb连不上,报错如下:
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
...
at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:588)
at org.pentaho.di.core.database.Database.normalConnect(Database.java:461)
... 48 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
看这个报错可以猜测jdbc的连接串是使用sid去连的,让开发尝试使用sid去连,确实能连上。但由于pdb使用的是service_name,还需要找到使用service_name连接oracle数据库方法。
查询文档发现方法如下:
- 不需要填主机名
- 数据库名写如下连接字符串:(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = IP地址)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = 服务名)))
- 端口号填:-1
如图:
文末吐槽一下,真不科学的连接方法。。。
参考