当前位置: 代码迷 >> Java Web开发 >> 求教!数据库连接有关问题!
  详细解决方案

求教!数据库连接有关问题!

热度:150   发布时间:2016-04-17 00:16:48.0
求教!数据库连接问题!急!急!
数据库为:oracle 安装在自己笔记本上,笔记本ip:192.168.1.101

Java code
 异常如下: java.sql.SQLException: Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently know of SID given in connect descriptorThe Connection descriptor used by the client was:192.168.1.101:1521:devorcljdbc文件如下:jdbc.driverClassName=oracle.jdbc.driver.OracleDriverjdbc.url=jdbc:oracle:thin:@192.168.1.101:1521:devorcljdbc.username=sjhosjdbc.password=sjhoslistener.ora 如下:SID_LIST_LISTENER =  (SID_LIST =    (SID_DESC =      (SID_NAME = PLSExtProc)      (ORACLE_HOME = g:\oracle\product\10.2.0\db_2)      (PROGRAM = extproc)    )  )LISTENER =  (DESCRIPTION_LIST =    (DESCRIPTION =      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))      (ADDRESS = (PROTOCOL = TCP)(HOST = hp-PC)(PORT = 1521))    )  )tnsnames.ora文件内容如下:ORCL =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = hp-PC)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = orcl)    )  )external_project =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = hp-PC)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = devorcl)    )  )DEVORCL =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = hp-PC)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = devorcl)    )  )


------解决方案--------------------
用sqlplus登录下看
------解决方案--------------------
服务启动了吗?
------解决方案--------------------
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = hp-PC)(PORT = 1521))
)
)

hp-PC改为你的iP地址
还有看看是不是防火墙把1521这个端口给封了
  相关解决方案