jodersky / simplesql

A no-frills SQL library for Scala 3
BSD 3-Clause "New" or "Revised" License
29 stars 2 forks source link

`generating` raises exception with MySQL #2

Closed nivox closed 2 years ago

nivox commented 2 years ago

Using generating with MysqlDataSource fails with the following exception:

Generated keys not requested. You need to specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate(), Statement.executeLargeUpdate() or Connection.prepareStatement().

Even after adding the required flag during the prepared statement creation, the operation still fails with:

java.sql.SQLException: Before start of result set

This is solvable by forcing a res.next() before trying to read the generated key.

MySQL driver version: 8.0.27 Java version: 11.0.9.1