java.sql.SQLRecoverableException:IO错误:网络适配器无法建立连接

时间:2015-01-06 09:32:35

标签: spring-jdbc

我在连接到spring JDBC时遇到了这个异常。我正在使用Oracle 11 XE。

  

2015年1月6日下午2:49:11 org.springframework.context.support.AbstractApplicationContext prepareRefresh           信息:刷新org.springframework.context.support.ClassPathXmlApplicationContext@5d099f62:启动日期[Tue Jan 06 14:49:11 IST 2015];上下文层次结构的根           2015年1月6日下午2:49:12 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions           信息:从类路径资源[com / jdbc / commons / application-context.xml]加载XML bean定义           Jan 06,2015 2:49:12 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons           信息:在org.springframework.beans.factory.support.DefaultListableBeanFactory@6b71769e中预先实例化单例:定义bean [dataSource,jdbcTemplate,empdao];工厂层级的根           2015年1月6日下午2:49:12 org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName           INFO:已加载的JDBC驱动程序:oracle.jdbc.driver.OracleDriver           线程" main"中的例外情况org.springframework.jdbc.CannotGetJdbcConnectionException:无法获取JDBC连接;嵌套异常是java.sql.SQLRecoverableException:IO错误:网络适配器无法建立连接               在org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)               在org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573)               在com.jdbc.dao.EmployeeDao.getEmployeesByName(EmployeeDao.java:84)               在com.jdbc.test.JdbcTemplateTest.main(JdbcTemplateTest.java:21)           引起:java.sql.SQLRecoverableException:IO错误:网络适配器无法建立连接               在oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)               at oracle.jdbc.driver.PhysicalConnection。(PhysicalConnection.java:546)               在oracle.jdbc.driver.T4CConnection。(T4CConnection.java:236)               at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)               at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)               at java.sql.DriverManager.getConnection(Unknown Source)               at java.sql.DriverManager.getConnection(Unknown Source)               在org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173)               在org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164)               在org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149)               在org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119)               在org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)               在org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)               ......还有3个           引起:oracle.net.ns.NetException:网络适配器无法建立连接               在oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:392)               at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:434)               at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:687)               at oracle.net.ns.NSProtocol.connect(NSProtocol.java:363)               at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)               在oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)               ......还有15个           引起:java.net.ConnectException:连接被拒绝:连接               at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)               在java.net.DualStackPlainSocketImpl.socketConnect(未知来源)               at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)               at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)               在java.net.AbstractPlainSocketImpl.connect(未知来源)               在java.net.PlainSocketImpl.connect(未知来源)               在java.net.SocksSocketImpl.connect(未知来源)               在java.net.Socket.connect(未知来源)               at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:150)               在oracle.net.nt.ConnOption.connect(ConnOption.java:133)               在oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:370)               ......还有20个

1 个答案:

答案 0 :(得分:0)

解决方案:我正在使用PostGres SQL jar 10.0并且我已将它更新到最近的jar并尝试了它并没有成功。在我取回数据库而不是创建新数据库之后,问题得到了解决。这是一些数据库问题。将驱动器配置更改为postgres驱动程序。