示例,可以参考下:
public static boolean getConnection(String url,String username,String password) {
String drivers = "oracle.jdbc.driver.OracleDriver"
System.setProperty("jdbc.drivers", drivers)
try {
Class.forName(drivers)
conn = DriverManager.getConnection(url, username, password)
return true
}
catch (Exception ex) {
ex.printStackTrace()
return false
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)