java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection

旧街凉风 提交于 2020-11-09 20:28:56

Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection

  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) ~[oracle-jdbc-driver-1.0.0.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) ~[oracle-jdbc-driver-1.0.0.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255) ~[oracle-jdbc-driver-1.0.0.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
  at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387) ~[oracle-jdbc-driver-1.0.0.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
  at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414) ~[oracle-jdbc-driver-1.0.0.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
  at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165) ~[oracle-jdbc-driver-1.0.0.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
  at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35) ~[oracle-jdbc-driver-1.0.0.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
  at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801) ~[oracle-jdbc-driver-1.0.0.jar:Oracle JDBC Driver version - "10.2.0.1.0"]
  at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) ~[commons-dbcp-1.4.jar:1.4]
  at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) ~[commons-dbcp-1.4.jar:1.4]
  at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556) ~[commons-dbcp-1.4.jar:1.4]
  at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) ~[commons-dbcp-1.4.jar:1.4]
  at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.4.jar:1.4]
  at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
  at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) ~[spring-jdbc-3.0.7.RELEASE.jar:3.0.7.RELEASE]
  at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) ~[spring-jdbc-3.0.7.RELEASE.jar:3.0.7.RELEASE]
  ... 19 more

  原因:未插网线(lll¬ω¬)

  公司的项目启动的时候报错,这个异常出现的很奇怪。因为之前一直好好的,启动的时候从来没有出过错,总不可能是因为今天不是黄道吉日,所以工程罢工了。

  看错误信息:The Network Adapter could not establish the connection,无法建立连接。我寻思着可能是数据库配置文件出了问题,然后在DBeaver中重新连接了一下,然后发现数据库也连不上了。那应该就不是我本机项目的问题了,可能是数据库真的出了问题。然后我又去问同事,发现他们的都正常。这就很奇怪了。然后我突然想起来我今天把网线转换头落在家里了,来公司之后一直用的是WIFI,猜测是WIFI环境连不上公司的库。去找人借了个转换头,连上网线,重启项目,成功。

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!