parameter.properties配置文件配置数据连接URL如下:
jdbc.url=jdbc:oracle:thin:@192.168.1.84:1521:devdb
报错如下:
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: 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
)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:240)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy14.getMatchMap(Unknown Source)
at com.ecp888.test.service.jczq.JczqServiceTest.testGetMatchMap(JczqServiceTest.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.commons.dbcp.SQLNestedException: 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
)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:202)
... 38 more
Caused by: 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:419)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
... 41 more
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:386)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
... 49 more
纠结了好久,我客户端D:\Program Files\Oracle_instantclient_11_2\NETWORK\ADMIN\tnsnames.ora的配置如下:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.75)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
devdb=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.84)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME =devdb.ecp888.com)
)
)
网上找出来的解决方法都是
http://anthon-lx.iteye.com/blog/811460,
按其操作,扔不能解决,最后问下负责ORACLE的同事,由于数据库采用集群,连接数据库URL不能用jdbc:oracle:thin:@192.168.1.84:1521:devdb,最终配置文件parameter.properties里改成
jdbc.url=jdbc:oracle:thin:@//192.168.1.84:1521/devdb.ecp888.com
搞定!!!
记下来,帮助自己记录
分享到:
相关推荐
之前用PL/SQL DEVELOPER和SQLPLUS 登录数据库都没有问题,就是应用程序通过JDBC连接Oracle时无法成功连接,出现ORA-12505错误listener does not currently know of SID given in connect descriptor
### Oracle 错误 ORA-00132 和 ORA-00214 解析及处理 #### 一、错误概述 在Oracle数据库管理过程中,遇到ORA-00132和ORA-00214这类错误时,往往意味着数据库配置或启动过程中出现了问题。下面将对这两个错误进行...
oracle远程连接服务器出现 ORA-12170 TNS:连接超时 解决办法,需要的朋友可以参考一下
ORA-12518 TNS:监听程序无法分发客户机连接,在您安装好数据库后配置连接数据库的过程中遇到这类问题应该很头疼吧,不过,当您还是四处查资料来解决您遇到的另你头疼的问题时,如果不经意间看到了这则贴子,那请您升...
用myeclispe来连接oracle数据库时出现了如下错误: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid environment specified
ORA-12541 TNSno listener 的解决方案 ORA-12541 TNSno listener 的解决方案
ORA-12154: TNS: 无法解析指定的连接标识符的解决方法
错误提示“ORA-12505: TNS:listener does not currently know of SID given in connect descriptor (DBD ERROR: OCIServerAttach)”表明监听器并不知道在连接描述符中给出的SID。这通常是因为客户端与服务器之间的...
### ORA-12560 TNS 协议适配器错误详解 #### 一、概述 在Oracle数据库管理过程中,经常会遇到各种各样的错误提示,其中“ORA-12560 TNS: 协议适配器错误”是较为常见的一种。这种错误通常发生在客户端尝试连接到...
ORACLE数据库遇到常见错误代码ORA-12541、ORA-01034、ORA-27101、ORA-00119和ORA-00132时的解决方法 一、ORA-12541错误的解决 ORA-12541错误,提示为"TNS:无监听程序",表示数据库的监听服务没有运行或者配置错误...
### Oracle报错ORA-12516:TNS:listener could not find available handler with matching protocol stack #### 报错概述 在Oracle数据库环境中遇到ORA-12516错误时,通常意味着监听器无法找到与请求协议栈匹配的...
4. 更新listener.ora文件,定义监听器以支持HS服务,指定SID、Oracle Home路径和所用的服务程序(如hsodbc或hsole,根据连接类型确定)。 通过以上步骤,用户可以成功配置Oracle数据库,使其能够通过异构服务访问...
解决ORACLE TNS: 无法解析指定的连接标识符; 里面有步骤
"ORA-12516 TNS 监听程序无法找到匹配协议栈的可用句柄" oracle 数据库是当前最流行的关系型数据库管理系统之一,然而,在使用 oracle 数据库时,经常会遇到各种错误信息,ORA-12516 错误信息便是其中之一。ORA-...
最近在工作中遇到了一个问题,错误是Oracle dbca时报错:ORA-12547: TNS:lost contact,通过查找相关的资料终于找到了解决的方法,下面分享给大家,话不多说了,来一起看看详细的介绍吧。 环境: OS:RHEL6.5 x86-...
TNS-12541: TNS: 无监听程序 TNS-12560: TNS: 协议适配器错误 TNS-00511: 无监听程序 文章转自:http://www.luocs.com/archives/464.html 此文版权归作者 – yaogang所有,转载请注明yaogang©www.luocs.com。 ...
实验得来的,不是随便copy的, ORA-12560TNS协议适配器错误,这个问题可定可以解决
ora-12514:TNS:监听程序当前无法识别连接描述符中请求的服务bug,解决文档.