java连接oracle出现错误,高手请帮助啊~~~~~~~~
各位高手:
我最近做一个项目,需要连接oracle数据库,我这样写程序连接:
public Connection getConnection()throws InstantiationException{
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url="jdbc:oracle:thin:172.21.3.201:1521:IERP";
//orcl为数据库的SID
String user="iufotest";
String password="1";
Connection conn= DriverManager.getConnection(url,user,password);
return conn;
} catch (ClassNotFoundException e) {
System.out.println("3");
System.out.println(e.toString());
return null;
} catch (SQLException e) {
System.out.println("4");
System.out.println(e.toString());
return null;
}
}
可是显示连接不上数据库,请问我哪里错了?搞了很久都不行,请高手救救我啊!!!!