JDBC连接异常处理

java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
 at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:404)
 at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
 at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
 at java.sql.DriverManager.getConnection(DriverManager.java:582)
 at java.sql.DriverManager.getConnection(DriverManager.java:185)
 at com.rule.struts.dbutil.DBConn.(DBConn.java:29)
 at com.rule.struts.dbutil.DBQuery.DBQuery(DBQuery.java:18)
 at com.rule.struts.dbutil.DBSQL.mainQuery(DBSQL.java:51)
 at com.rule.struts.dbutil.testOra.main(testOra.java:29)
Exception in thread "main" java.lang.NullPointerException
 at com.rule.struts.dbutil.DBConn.executeQuery(DBConn.java:41)
 at com.rule.struts.dbutil.DBQuery.DBQuery(DBQuery.java:19)
 at com.rule.struts.dbutil.DBSQL.mainQuery(DBSQL.java:51)
 at com.rule.struts.dbutil.testOra.main(testOra.java:29)

 

 

数据库连接池设置错误:

"jdbc:oracle:thin:@111.111.111.111:1111:query";

//dbUrl数据库连接串信息,其中“111.111.111.111”为数据库所在服务器IP地址,“1111”为端口,“query”为SID

如果SID设置错误就会抛出上述异常。

你可能感兴趣的:(Oracle)