首页 > 代码库 > mysql和oracle的驱动方式

mysql和oracle的驱动方式

mysql:
Class.forName("com.mysql.jdbc.driver");
Connection c = DriverManager.getConnection("jdbc:mysql://localhost:3306/databasename", user, password); 
Statement statamentMySQL =connectMySQL.createStatement();
ResultSet resultSel = statement.executeQuery( "select * from staff" ); 



oracle:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection c = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:databasename", user, password); 
Statement statamentMySQL =connectMySQL.createStatement();
ResultSet resultSel = statement.executeQuery( "select * from staff" ); 

mysql和oracle的驱动方式