1、加载驱动 Class.forName(驱动);
Mysql:com.mysql.jdbc.Driver
Oracle:com.jdbc.driver.OracleDriver
2、获得数据库连接
Connectionconn=DriverManager.getConnection(URL,USER,PASSWORD);
URL:jdbc:mysql://127.0.0.1:3306/数据库名
3、Statement stmt=conn.createStatement();
ResultSet rs=Stmt.executeQuery(SQL语句);