(一定赚了分才采纳) java.sql.SQLException:关闭的 Resultset:next

(一定赚了分才采纳) java.sql.SQLException:关闭的 Resultset:next
String sql="select * from t_student";
x05x05List list = jdbcTemplate.query(sql,new RowMapper() {
x05x05x05public Object mapRow(ResultSet rs,int arg1) throws SQLException {
x05x05x05x05List list = new ArrayList();
x05x05x05x05try {
x05x05x05x05x05
x05x05x05x05x05x05while (rs.next()) {
x05x05x05x05x05x05.x05
}
而且异常指向的是这一行:
List list = jdbcTemplate.query(sql,new RowMapper()
梧桐听雨 1年前 已收到1个回答 举报

i_dq2b06ca5b96 幼苗

共回答了16个问题采纳率:81.3% 举报

while (rs.next()) {
x05x05x05x05x05x05.x05
}
这个不需要这么写,直接写
Students st = new Students();
st.setName(rs.getString(1));
list.add(st);
因为是每行结果所以你再rs.next()就报错了,已经被关闭了,你看,mapRow的意思就是每行

1年前

9
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 1.043 s. - webmaster@yulucn.com