美文网首页我爱编程
Jdbc连接Oracle数据库

Jdbc连接Oracle数据库

作者: 朱燊 | 来源:发表于2017-05-05 02:45 被阅读0次

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数据库

    本文链接:https://www.haomeiwen.com/subject/txljtxtx.html