public static void main(String[] args) throws Exception {
//连接JDBC的步骤
//1.注册驱动
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
//2.获取连接
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/sealong","root","12345678");
//3.获取操作数据库的预处理对象
PreparedStatement pstm= connection.prepareCall("select * from account");
//4.执行SQL,得到结果集
ResultSet set = pstm.executeQuery();
//5.遍历结果集
while (set.next()){
System.out.println(set.getString("money"));
System.out.println(set.getString("id"));
System.out.println(set.getString("uid"));
}
//6.释放资源
set.close();
pstm.close();
connection.close();
}