java.sql.SQLException: Generated keys not requested. You need to specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate(), Statement.executeLargeUpdate() or Connection.prepareStatement().
经过检查发现从5.1.7版本之后的mysql-connector增加了返回GeneratedKeys的条件,如果需要返回GeneratedKeys,则PreparedStatement需要显式添加一个参数Statement.RETURN_GENERATED_KEYS,如下:
connection = JDBCUtil.getConnection(); preparedStatement = connection.prepareStatement(sql.toString(),Statement.RETURN_GENERATED_KEYS);
更新mysql驱动5.1-47 Generated keys not requested. 错误
标签:exce 返回 gen ret spec 版本 出现 添加 get
查看更多关于更新mysql驱动5.1-47 Generated keys not requested. 错误的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did118027