String driver="oracle.jdbc.driver.OracleDriver";
String url="jdbc:oracle:thin:@localhost:1521:zhushen";
String user = "system";
String password = "Code531182";
try {
Class.forName(driver);
}catch(ClassNotFoundException e) {
System.out.println("Sorry,can`t find the Driver!");
}
try{
Connection conn=DriverManager.getConnection(url1,user,password);//开始连接
if(!conn.isClosed())
System.out.println("Succeeded connecting to the Database!");
}catch(Exception e){
e.printStackTrace();
网友评论