1.注册驱动
Class.forName(com.mysql.jdbc.Driver);
2.获取连接
String url="jdbc:mysql://localhost:3306/mydb";
Connection conn=DriverManeger.getConnection(url,""root,root);
3.获取执行sql语句的对象
Statement stmt = conn.createStatement();
4.执行sql语句
ResultSet rs = stmt.executeQuery("select * from category");
5.处理结果
6.释放资源