Jdbc连接Oracle数据库

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();

你可能感兴趣的:(Jdbc连接Oracle数据库)