在java与oracle连接中出了问题
代码如下:import java.sql.*;
public class TestJDBC {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@127.0.0.1:1521:local", "scott", "tiger");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from dept");
while(rs.next()){
System.out.println(rs.getString("deptno"));
}
}
}
报错:java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
希望能给点宝贵意见