标签:mysql name str mys size catch exce ack lex
public List<Student>list = new ArrayList<>(int page) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } try (Connection connection = DriverManager.getConnection(url, user, pass)) { int size =2; String sql = "SELECT * FROM student order by asc limit ?,?"; java.sql.PreparedStatement statement = connection.prepareStatement(sql); int p = (page-1)*size;//分页id算法,用于计算开始id statement.setInt(1, p); statement.setInt(2,size); } catch (SQLException e) { e.printStackTrace(); } }
标签:mysql name str mys size catch exce ack lex
原文地址:https://www.cnblogs.com/max-hou/p/12090741.html