java 中如何执行插入操作后返回自增id

来源:互联网 发布:淘宝物流信息技术运用 编辑:程序博客网 时间:2024/05/15 09:28
参考JAVA 的APIInterface  java.sql.Statement int executeUpdate(String sql,  int autoGeneratedKeys)          Executes the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.


sql要是insert语句int key = statement.executeUpdate(sql, Statement.RETURN_GENERATED_KEYS);//

0 0