java使用jabc连接oracle时,出现异常:
Java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169869568)(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(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at xx.TestCon.main(TestCon.java:17)
这个异常应该是你使用的数据库连接字符串中的SID_NAME出现错误:jdbc:oracle:thin:@[ip]:1521:SID_NAME ,请检查SID_NAME。
select INSTANCE_NAME from v$instance; –查看当前数据的库sid_name。