Home > Database > Mysql Tutorial > body text

Oracle:listener does not currently know of SID given in conn

WBOY
Release: 2016-06-07 17:04:37
Original
1669 people have browsed it

一次连接数据库怎么也连接不上,查了多方面资料,终于找到答案,总结首先应该保证数据库的服务启动 在myeclipse的数据库视图中点

一次连接数据库怎么也连接不上,查了多方面资料,终于找到答案,总结

首先应该保证数据库的服务启动
在myeclipse的数据库视图中点 右键->new 弹出database driver的窗口,
Driver template选择Oracle(thin driver),
Driver name 输入oracle  
connection URL=jdbc:oracle:thin:@localhost:1521:oracle 注意localhost:1521:oracle中的oracle是数据库得sid换成你自己数据库的sid就可以
username:登陆数据库具有system权限的用户名
password:登陆数据库具有system权限的密码
点击add jar 选择ojdbc14.jar的存放位置,没有得可以到百度下一个叫ojdbc14.jar的文件。
点击test driver 到此成功配置。

关于启动数据库后提示ora-12505的解决方法:
"listener does not currently know of SID given in connect descriptor"

第一种可能
是配置得数据库sid名不正确localhost:1521:oracle 即红字部分不是你本机得sid,那么如何查看本机得sid呢?用如下命令 SELECT   NAME   FROM   v$database;在sqlplus中执行就可以看到,把红字部分换成查询出来的sid就可以。
第二种可能
发现sid配置没有错误,但是还是报错,那可能就是oracle得监听配置出了问题,,需要检查listener.ora文件,用记事本打开,
正确配置如下:
# listener.ora Network Configuration File: e:\oracle\product\10.2.0\db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = e:\oracle\product\10.2.0\db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = oracle)
      (ORACLE_HOME = e:\oracle\product\10.2.0\db_1)
      (SID_NAME = oracle)
    )
  )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )
红字部分改成oracle创建时候的sid 保存退出。

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!