方法1:
private String driver="oracle.jdbc.driver.OracleDriver";
private String url="jdbc:oracle:thin:@wyc:1521:orcl";
private String user="wyc";
private String password="o123";
private Connection conn =null;
Class.forName(driver);
conn=DriverManager.getConnection(url, user, password);
方法2:
String url="jdbc:oracle:thin@localhost:1521:orcl";
String name="wyc";
String password="o123";
//-Djdbc.drivers=oracle.jdbc.driver.OracleDriver
//System.setProperty("jdbc.drivers", driver);
//Class.forName(driver);
Connection conn= DriverManager.getConnection(url, name, password);
方法3:
String url="jdbc:oracle:thin@localhost:1521:orcl";
String name="wyc";
String password="o123";
Driver d =new OracleDriver();
Connection conn= DriverManager.getConnection(url, name, password);
待续。。。