Specific error
Java.sql.SQLRecoverableException:Io exception: The network Adapter could not establish the connection
At Oracle.jdbc.driver.SQLStateMapping.newSQLException (sqlstatemapping.java:101)
At Oracle.jdbc.driver.DatabaseError.newSQLException (databaseerror.java:112)
At Oracle.jdbc.driver.DatabaseError.throwSqlException (databaseerror.java:173)
At Oracle.jdbc.driver.DatabaseError.throwSqlException (databaseerror.java:229)
At Oracle.jdbc.driver.DatabaseError.throwSqlException (databaseerror.java:458)
At Oracle.jdbc.driver.T4CConnection.logon (t4cconnection.java:411)
At Oracle.jdbc.driver.physicalconnection.<init> (physicalconnection.java:490)
At Oracle.jdbc.driver.t4cconnection.<init> (t4cconnection.java:202)
At Oracle.jdbc.driver.T4CDriverExtension.getConnection (t4cdriverextension.java:33)
At Oracle.jdbc.driver.OracleDriver.connect (oracledriver.java:474)
At Java.sql.DriverManager.getConnection (Unknown Source)
At Java.sql.DriverManager.getConnection (Unknown Source)
At CHAP6. Dbutil.getconnection (DBUTIL.JAVA:14)
At CHAP6. Statementdemo.main (statementdemo.java:15)
Java.sql.SQLException: Driver error or Connection failed!
At CHAP6. Dbutil.getconnection (DBUTIL.JAVA:20)
At CHAP6. Statementdemo.main (statementdemo.java:15)
Solution One
Then the firewall opened 3 ports, 8080, 8009, 8005, the problem is done
Solution II
Oracle's thin connection is divided into two types, one is the SID, the other is service name, and the difference is how the server configures the SID or service name, and after you configure the database, you can
The code is as follows |
Copy Code |
D:oracleproduct10.2.0db_1networkadmin |
Directory search, Tnsnames.ora file, look inside the parameters
According to the above data configuration to confirm which way
A, in the case of Sid mode, the JDBC Connection database is in the form of
The code is as follows |
Copy Code |
String url = "Jdbc:oracle:thin:@//192.168.10.105:1522:uportal"; |
Note that in the case of a data instance, you use the English colon:
B, in the case of service mode, the JDBC connection data is in the form of
The code is as follows |
Copy Code |
String url = "Jdbc:oracle:thin:@//192.168.10.105:1522/uportal"; |
Note that in the case of a data instance, you use the English slash/