系统:Windows 8
IDE:MyEclipse2014
部署环境:JDK1.6.0_38、Tomcat7.0.55
Exception in thread "main" org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (IO 错误: Got minus one from a read call)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at wxcsbi.TestGetDataSource.main(TestGetDataSource.java:36)
Caused by: java.sql.SQLException: IO 错误: Got minus one from a read call
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
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:294)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
... 2 more
Caused by: oracle.net.ns.NetException: Got minus one from a read call
at oracle.net.ns.Packet.receive(Packet.java:303)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:296)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
... 10 more
网上找了下,基本提供的方法有这么几种:
1:数据库连接满了,扩大数据库连接池
2:所登录的机子IP不在sqlnet.ora内,加入后重启listerner即可
3:数据库负载均衡时,指定了(SERVER=DEDICATED),去除这个即可
4:网管在Oracle配置上限制了该台机子访问Oracle的权限,这个问题基本和2类似,也是修改Oracle配置即可
按照以上方法来修改后,都不起作用。将oracle驱动包oracle-driver-11.2.0.3.jar换成ojdbc14.jar后,能正常连接数据库。