Skip to Content
0

Is retrieving autogenerated keys supported by Hana jdbc driver

Aug 03, 2017 at 05:39 PM

66

avatar image
Former Member

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

SQL
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Lars Breddemann
Aug 04, 2017 at 01:51 AM
1

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.

Share
10 |10000 characters needed characters left characters exceeded