hibernate 访问oracle ORA-12505,

J2EE 码拜 9年前 (2015-04-04) 1135次浏览 0个评论
 

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

数据库搭建在linux centos上,tomcat也部署在上面,取名为服务器A
SQL>  select INSTANCE_NAME from v$instance;
 
INSTANCE_NAME
—————-
orcl

hibernate配置文件:
 <property name=”connection.url”>jdbc:oracle:thin:@localhost:1521:orcl</property> 

每次把数据库监听stop再 start以后,在我的本机使用浏览器访问服务器A的 web页面就会报 ORA-12505,的错误。
但 如果在我本机 使用plsql登录一下服务器的数据库后,web页面就可以正常访问了。觉得这是一个很奇怪的问题。

还发现一个问题,在本机使用plsql登录服务器的oracle后,监听的状态会发生变化.
未登录前
The listener supports no services
The command completed successfully
登录过后
Service “orcl” has 1 instance(s).
  Instance “orcl”, status READY, has 1 handler(s) for this service…
Service “orclXDB” has 1 instance(s).
  Instance “orcl”, status READY, has 1 handler(s) for this service…
The command completed successfully
高人来指点

hibernate 访问oracle ORA-12505,
20分
<property name=”connection.url”>jdbc:oracle:thin:@localhost:1521:orcl</property> 端口后面应该是sid吧,也可能和INSTANCE_NAME一样。
hibernate 访问oracle ORA-12505,
那2个 我都配的一样的噢

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明hibernate 访问oracle ORA-12505,
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!