日期:2014-05-18 浏览次数:20624 次
public static Connection getConnection() throws Exception{
Connection con=null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url = "jdbc:oracle:thin:@172.30.60.58:1521:SPCGTHR";
String user = "spc";
String password = "spc";
con = DriverManager.getConnection(url, user, password);
}catch (InstantiationException e1) {
e1.printStackTrace();
throw e1;
} catch (IllegalAccessException e1) {
e1.printStackTrace();
throw e1;
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
throw e1;
} catch (SQLException e) {
e.printStackTrace();
throw e;
}
return con;
}