Skip to main content
Question

PreparedStatement.RETURN_GENERATED_KEYS JDBC Error

  • February 15, 2019
  • 0 replies
  • 9 views

scottysak

Any insight on this if customer is using RETURN_GENERATED_KEYS?

While using JDBC to insert rows into a table, which has a primary key of type IDENTITY, we are unable to fetch the generated key the traditional way using PreparedStatement.RETURN_GENERATED_KEYS.
Code snippet :
pst = con.prepareStatement(save, PreparedStatement.RETURN_GENERATED_KEYS);
pst.executeUpdate();
rs = pst.getGeneratedKeys();

We are getting an error on the line:
java.sql.SQLFeatureNotSupportedException: [Vertica]JDBC Driver not capable.

I have tried with the driver jars version 9.2 as well as 9.1.1 with the same results.

Could you please get it confirmed if it is expected behavior or not, and what is the workaround for this.