Sqlite JDBC driver not supporting RETURN_GENERATED_KEYS

前端 未结 2 2005
南笙
南笙 2021-01-05 18:51

I am using Xerial latest jdbc driver for sqlite (version 3.7.2) It does not seem to have support for Statement RETURN_GENERATED_KEYS. I keep getting \"not implemented by SQL

2条回答
  •  一生所求
    2021-01-05 19:32

    I'm also using sqlite-jdbc-3.7.2.jar and found that using RETURN_GENERATED_KEYS does fail, however merely doing a statement.execute(sql) followed by resultset = statement.getGeneratedKeys() and meta = resultset.getMetaData() shows that a column name last_insert_rowid() is available in the resultset. So resultset.getInt("last_insert_rowid()") does indeed return the newly inserted rowid without an additional select.

提交回复
热议问题