cancel
Showing results for 
Search instead for 
Did you mean: 

Is retrieving autogenerated keys supported by Hana jdbc driver

Former Member
0 Kudos

Hi,

In relation to this and thread https://archive.sap.com/discussions/thread/3340106

Do you know if retrieving Auto generated keys is now supported by the Hana jdbc driver. The below exception is throw when using this feature with the driver obtained from Hana db client version 1.00.120.050.1484020229 . Do you know if this is now supported and which version of the client has the driver?

java.lang.UnsupportedOperationException: Retrieving auto generated keys is not supported.

Regards,

Kalabase

Accepted Solutions (0)

Answers (1)

Answers (1)

lbreddemann
Active Contributor

Easy to try it out!

  1. Download & install current HANA 2 client package - check.
  2. Set classpath to point to new ngdbc.jar - check.
  3. Run test program and trace:
package package com.sap.db.jdbc, 
Java Platform API Specification, version 1.6, 
SAP HANA JDBC Driver, SAP SE,
2.0.14-2d2417a0b831eafc24c4a6d30206b73d62a858e5 on Java 1.8.0_121
=> com.sap.db.jdbc.CallableStatementSapDBFinalize@5e8c92f4
com.sap.db.jdbc.CallableStatementSapDBFinalize@5e8c92f4.setString(1, Barb)
com.sap.db.jdbc.CallableStatementSapDBFinalize@5e8c92f4.executeUpdate()
=> 1
com.sap.db.jdbc.CallableStatementSapDBFinalize@5e8c92f4.getGeneratedKeys()
 <-!
Timestamp: 2017-08-04 11:46:31.87com.sap.db.jdbc.exceptions.SQLFeatureNotSupportedExceptionSapDB: Retrieving auto generated keys is not supported.
at com.sap.db.jdbc.exceptions.SQLExceptionSapDB._createException(SQLExceptionSapDB.java:155)
at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.generateSQLException(SQLExceptionSapDB.java:26)
at com.sap.db.jdbc.StatementSapDB._getAutoGeneratedKeysNotSupportedException(StatementSapDB.java:1683)
at com.sap.db.jdbc.StatementSapDB.getGeneratedKeys(StatementSapDB.java:1201)
at test.InsertWithIDColumn.main(InsertWithIDColumn.java:77)

So, I'd say: no, it's not supported.