1.Oracle连接语句://对应class12.jarString driver="oracle.jdbc.driver.OracleDriver";String url="jdbc:oracle:thin:@localhost:1521:test";
//...........:oci8:@localhost:1521:test
Connection con=null;try{Class.forName(driver);con=DriverManager.getConnection(url,"scott","tiger");}catch(ClassNotFoundException){ }catch(SQLException){}2.SQL连接语句://对应jtds.jarString driver="net.sourceforge.jtds.jdbc.Driver";String url="jdbc:jtds:sqlserver://localhost:1433/test";Connection con=null;try{Class.forName(driver);con=DriverManager.getConnection(url,"sa","");}catch(ClassNotFoundException){ }catch(SQLException){}3.Mysql连接语句://对应mm.mysql-2.0.4-bin.jarString driver="org.gjt.mm.mysql.Driver";String url="jdbc:mysql://localhost:3306/zxks";
try { Class.forName(driver); con=DriverManager.getConnection(str,"root","");} catch (ClassNotFoundException e) { // TODO 自动生成 catch 块 e.printStackTrace();} catch (SQLException e) { // TODO 自动生成 catch 块 e.printStackTrace();} |