我正在尝试从我的 java 代码中获取列的最大数据,但结果集中出现错误
我的代码如下所示
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/testdb123","root","root");
LOGGER.info("connected to the database");
Statement stmt0 = conn.createStatement();
String qr= "INSERT INTO stumarks " + "VALUES ("+null+","+marks+")";
Statement stmt1 = conn.createStatement();
stmt1.executeUpdate(qr);
String countQuery = "select MAX('seqNum') as count1 from stumarks";
ResultSet res = stmt0.executeQuery(countQuery);
LOGGER.info("result set success!!");
int num = res.getInt("count1");``
System.out.println(num);