jdbc链接oracle

String url = "jdbc:oracle:thin:@127.0.0.1:1521:orcl";
Connection con = null;
String user = "test";
String password = "test";
try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection(url, user, password);
    out.write("连接成功!");
} catch (Exception e) {
    e.printStackTrace();
    out.write("连接失败!");
}

猜你喜欢

转载自sdauying.iteye.com/blog/1594859