ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
引子:
本项目在老电脑上用的是oracle10g,换新电脑装的是oracle11g,但运行项目本没有什么关系,本来说创建个用户,用PLSQL手工导入数据,再改几下配置文件即可跑起来--但实际启动中遇到以下异常导致eclipse不能启动:
2016-01-25 11:34:39,694 DEBUG (com.mchange.v2.resourcepool.BasicResourcePool:1831) - An exception occurred while acquiring a poolable resource. Will retry.
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
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:385)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
... 12 more
该异常属于第一次遇到,而且诡异的是,我用cmd面板、PLSQL、sqldeveloper 这几种方式连接都正常,唯独能不能再eclipse上连接,然后百度一搜,有很多答案,但基本上都是一个--修改Oracle的 listener.ora 文件,如下面的博文:
http://blog.csdn.net/hxl122lcq/article/details/7542462
但用此方法解决失败。用此方法的解决的所针对的版本的基本上都是10g的,我的是11g的,但应该不是这个原因引起解决失败的。
现在已经解决了,这是我当前的 listener.ora 文件:
# listener.ora Network Configuration File: D:\oracle11g\product\11.2.\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools. SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\oracle11g\product\11.2.\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\oracle11g\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
) LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = ))
)
) ADR_BASE_LISTENER = D:\oracle11g
上面是我现在的 listener.ora 文件,也是oracle11g默认的 listener.ora 文件,本来我已经用网上的方法把此文件修改成以下的配置:
# listener.ora Network Configuration File: D:\oracle11g\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools. SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\oracle11g\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\oracle11g\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = D:\oracle11g\product\11.2.0\dbhome_1)
(SID_NAME = ORCL)
)
) LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.127.0.34)(PORT = 1521))
)
) ADR_BASE_LISTENER = D:\oracle11g
注:红色字体为新增内容。
可是是什么时候它又恢复了默认配置?--我不得而知(我在改后应该没有进行恢复)。--不管它了,总之最重要的结论是:网上的这种解决方式并不能解决我的问题!那我是如何解决的呢?--其实我也不太清楚,应该是下面的某一节点、行为解决了此问题。下面是我的解决过程:
先贴出我的相关配置文件:
jdbc.properties (注:用的是c3p0)
#hibernate.connection.provider_class=com.jolbox.bonecp.BoneCPDataSource
#hibernate.connection.provider_class=com.jolbox.bonecp.provider.BoneCPConnectionProvider
# c3p0
hibernate.connection.provider_class=com.mchange.v2.c3p0.ComboPooledDataSource
hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
#hibernate.connection.url=jdbc\:oracle\:thin\:@116.252.178.236\:\:orcl
hibernate.connection.url=jdbc\:oracle\:thin\:@localhost\:1521\:orcl
hibernate.connection.username=mynewdpi
hibernate.connection.password=root bonecp.idleMaxAge=
bonecp.idleConnectionTestPeriod=
bonecp.partitionCount=
bonecp.acquireIncrement=
bonecp.maxConnectionsPerPartition=
bonecp.minConnectionsPerPartition=
bonecp.statementsCacheSize=
bonecp.releaseHelperThreads=
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
hibernate.show_sql=true
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
hibernate.cache.use_query_cache=true
applicationContext.xml
<!--配置bonecp连接池 -->
<bean id="dataSource" class="${hibernate.connection.provider_class}" >
<property name="driverClass" value="${hibernate.connection.driver_class}" />
<property name="jdbcUrl" value="${hibernate.connection.url}" />
<property name="user" value="mynewdpi"/>
<property name="password" value="root"/>
</bean>
1.配置SID的环境变量
新建这个环境变量 值为orcl

ORA-12505, TNS:listener does not currently know of SID given in connect descriptor的更多相关文章
- Connection to Oracle failed. [66000][12505] Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor .
我安装了Oracle数据库,默认的数据库用户名是system,密码口令是安装过程中你自己设置的.可以先使用命令框,输入 sqlplus system; 然后再输入密码即可. 然后我的数据库连接工具使用 ...
- Oracle - ORA-12505, TNS:listener does not currently know of SID given in connect descriptor 解决
java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:list ...
- ORA-12505, TNS:listener does not currently know of SID given in connect descriptor (二)
异常及解决 在连接sqldeveloper出现的异常信息 在ORA-12505, TNS:listener does not currently know of SID given in connec ...
- 关于ORA-12505, TNS:listener does not currently know of SID given in connect descriptor报错问题解决办法
1.本机tnsnames.ora 配置如下 test4= (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.1 ...
- 连接oracle数据库出现:ORA-12505,TNS:listener does not currently know of SID given in connect descriptor
Java使用 jdbc:oracle:thin:@11.1.0.14:1521:orcl 连接oracle数据库出现: ORA-12505,TNS:listener does not currentl ...
- 66000][12505] Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor oracle.n et.ns.NetException: Listener refuse
新装的idea开发工具后连接数据库出现如题所示错误. 1.网上搜了不少的文章,没有解决我的问题.后来细心看了一下url: 一开始url是这样子的. jdbc:oracle:thin:@:s21_pdb ...
- 【java】ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
如果是负载均衡,则 jdbc.url=jdbc:oracle:thin:@(description=(address_list= (address=(host=XX.XXX.X.XX) (protoc ...
- ORA-12514, TNS:listener does not currently know of service requested in connect descriptor案例2
今天使用SQL Developer连接一台测试服务器数据库(ORACLE 11g)时,遇到了"ORA-12514, TNS:listener does not currently know ...
- oracle ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor 1.看看是不是监听 ...
随机推荐
- CSS之自适应布局webkit-box
自适应布局webkit-box,在平常的web横排布局中,会经常用到float或display:inline-block,但是在多种不同宽度的移动设备的自适应布局中用的话,还得设置百分比宽度和考虑清除 ...
- eclipse不能更改设置tomcat 中的ServerLocation问题
当自己用eclipse写好了web项目后,也同时配置了服务器(tomcat6), 上面部署完毕后,直接访问http://localhost:8080 发现是 无法访问的,这是因为,Servers这里的 ...
- 走出 null 就是空值的误区,以及变量赋值原理
先放一张图片作为引入: 这里我用了一个示意图作为讲解: 平时,我们写的变量为什么能在我们调用它的时候就能被我们拿到所用,跟存钱罐一样,你往里面存一元大洋,它里面就有一元大洋,那么我们的变量在被我们创建 ...
- 基于JQuery+JSP的无数据库无刷新多人在线聊天室
JQuery是一款非常强大的javascript插件,本文就针对Ajax前台和JSP后台来实现一个无刷新的多人在线聊天室,该实现的数据全部存储在服务端内存里,没有用到数据库,本文会提供所有源程序,需要 ...
- Cadence OrCad Allegro SPB 16.6 下载及安装破解指南
Cadence公司的电子设计自动化产品涵盖了电子设计的整个流程,包括系统级设计,功能验证,IC综合及布局布线,模拟.混合信号及射频IC设计,全定制集成电路设计,IC物理验证,PCB设计和硬件仿真建模等 ...
- HTML5-Video & Audio
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- Bundle、Intent、SharedPreferences
Intent与Bundle的共同点:都继承Parcelable Intent传值与Bundle传值的区别 eg:我现在要从A界面 跳转到B界面或者C界面 这样的话 我就需要写2个Intent ...
- PHP -Session 深入解剖 ① session的基本操作 【大成出品 --必是精品】。
Session的初步介绍 1 Session是服务器端技术,利用这个技术,服务器在运行时可以为每一个用户的不同浏览器(一个用户的不同浏览器将生成不同的session文件)创建一个其独享的sessio ...
- TCP HelloWord
client.cpp #include <stdio.h> #include <winsock2.h> #pragma comment (lib,"ws2_32&qu ...
- iOS实现图片的缩放和居中显示
直接上代码 // // MoveScaleImageController.h // MoveScaleImage // // Created by on 12-4-24. // Copyright ( ...