我曾经执行过这个查询没有任何问题,但最近我遇到了异常。
(在 mysql 服务器上)
48442 [NioProcessor-1] ERROR c.x.xpofacebook.mysql.MysqlDb - SQLException: Before start of result set
48443 [NioProcessor-1] ERROR c.x.xpofacebook.mysql.MysqlDb - SQLState: S1000
48443 [NioProcessor-1] ERROR c.x.xpofacebook.mysql.MysqlDb - VendorError: 0
48451 [NioProcessor-1] ERROR c.x.xpofacebook.mysql.MysqlDb - stack trace: java.sql.SQLException: Before start of result set
编码:
String createPlayerRow = "insert into highscore_challenge_player "
+ "(fb_user_id,played,best_score,highscore_challenge_id) values ((select fb_user.id from fb_user where uid=?),?,?,?)";
stmt.close();
stmt = conn.prepareStatement(createPlayerRow,Statement.RETURN_GENERATED_KEYS);
stmt.setLong(1, uid);
stmt.setInt(2, 0);
stmt.setInt(3, 0);
stmt.setInt(4, highscoreChallengeId);
stmt.executeUpdate();
rs = stmt.getGeneratedKeys();
rowId = rs.getInt(1); <--- ERROR IN THIS LINE
有任何想法吗 ?!?
谢谢