数据库抛错
程序代码:
private static String url = \"jdbc:oracle:thin:@localhost:1521:system\";private static String user = \"system\";
private static String pw = \"19821227\";
private static Connection con = null;
public static Connection getConnection() {
if(con==null){
try {
Class.forName(\"oracle.jdbc.driver.OracleDriver\");
con = DriverManager.getConnection(url, user, pw);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
return con;
}
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
这是为什么啊?