Getting the generated key value in JDBC on Teradata V2R6.0
I have a java app that tries to insert things into the database. I use Teradata 12.0 JDBC driver and the 12.0 express edition db for the development, but the production db is release V2R.06.00.02.38, version 06.00.02.76. After an insert, the app tries to get the values of the id column (GENERATED BY DEFAULT AS IDENTITY) using getGeneratedKeys(). It fails with an error:
[NCR] [Teradata JDBC Driver] [TeraJDBC 12.00.00.01] Generated Keys are not supported with this release of the Teradata Database.:
There is a 'Teradata Driver for the JDBC Interface User Guide'
Error 1128 AutoGenerated Keys are not supported with this release of database software. The database must be running V2R6.2 or higher may be returned if any of the methods are called that request Auto Generated Keys.
I get this error on my production database, development works fine. I assume that the getGeneratedKeys() works only with version 6.2 and above, while I have to work with 6.0
I'm new to teradata and my question is how to work with this limitation. There are no sequences in teradata, where I'd be able to prefetch the next id value. What is the best practice?