我已经在我的系统上安装了 Oracle 11g,并且能够使用简单的 java 程序连接到数据库。
ORACLE_USER = "user1"
ORACLE_PASSWORD = "user1"
ORACLE_HOST = "localhost"
ORACLE_SID = "ORCL"
ORACLE_PORT = "1521 "
String connectionString = "jdbc:oracle:thin:@(description=(address=(host=" + ORACLE_HOST
+ ")(protocol=tcp)(port=" + ORACLE_PORT + "))(connect_data=(sid=" + ORACLE_SID + ")))";
Connection connection = DriverManager.getConnection(connectionString, ORACLE_USER,ORACLE_PASSWORD);
现在,我想连接我的队友系统的数据库(局域网网络)。我可以ping通那个系统。我在上面的代码中所做的唯一改变是
ORACLE_HOST = "kdsystem" //machine name
但相同的代码失败并显示以下错误消息:
java.sql.SQLException: Io exception: The Network Adapter could not establish the
connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
414)
......
....
请帮我解决这个问题。谢谢。