连接ORACLE
程序员文章站
2022-03-21 18:01:26
...
package com.cw.test;
import java.sql.Connection;
import java.sql.DriverManager;
public class DBManager {
public DBManager() {
}
/**
* @param args
*/
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@10.0.3.220:1521:orcl ";
Connection c = DriverManager.getConnection(url, "ymbi",
"ymbi");
System.out.println("c=="+c);
} catch (Exception e) {
e.printStackTrace();
}
}
}
import java.sql.Connection;
import java.sql.DriverManager;
public class DBManager {
public DBManager() {
}
/**
* @param args
*/
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@10.0.3.220:1521:orcl ";
Connection c = DriverManager.getConnection(url, "ymbi",
"ymbi");
System.out.println("c=="+c);
} catch (Exception e) {
e.printStackTrace();
}
}
}