Lucas-307 edited a comment on issue #7922:
URL: https://github.com/apache/shardingsphere/issues/7922#issuecomment-717669435


   @tristaZero Can we get `lastInsertId` by jdbc `ps.getGeneratedKeys()` in 
version 4?
   
   like this:
   ```java
   try (Connection conn = DriverManager.getConnection(url, username, password);
       PreparedStatement ps = conn.prepareStatement(sql, 
Statement.RETURN_GENERATED_KEYS)) {
       ps.executeUpdate();
       ResultSet rs = ps.getGeneratedKeys(); // get GeneratedKeys by SS 
SnowFlake or others.
       return rs.next() ? rs.getLong(1) : -1;
   }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to