`
清晨迎朝阳
  • 浏览: 64081 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

ORA-12505

 
阅读更多

问题描述:
今天开发项目,在redhat5.3上部署好了oracle,然后在项目中使用jdbc连接oracle数据库的时候出现了下列错误:

Cannot create PoolableConnectionFactory (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:
72.160.0.67:1521:ora10g)

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

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

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

SQL> select INSTANCE_NAME from v$instance;

INSTANCE_NAME
----------------
erp

 

修改为:jdbc:oracle:thin:@72.160.0.67:1521:erp即可。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics