// 查问表test_01中的所有数据public class JDBCUtilsSelectTest { public static void main(String[] args) throws SQLException { // 1。获取连贯 Connection conn = JDBCUtils.getConnection(); // 2。获取语句执行平台,即Statement对象 Statement sqlExecute = JDBCUtils.createStatement(conn); // 3。执行sql语句 String sql = "select * from test_01;"; ResultSet resultSet = sqlExecute.executeQuery(sql); // 4。处理结果集 while(resultSet.next()){ int id = resultSet.getInt("id"); String name = resultSet.getString("name"); int age = resultSet.getInt("age"); System.out.println("id = " + id + ", name = " + name + ", age = " + age); } // 5。敞开对象 JDBCUtils.close(conn,sqlExecute,resultSet); }}