Search code examples
oracle-databasejdbc

"autoKeyInfo is not initialized" when trying to batch insert into table with generated id


When I tried to upgrade my Oracle JDBC driver from ojdbc8 19.6.0.0 to ojdbc11 21.6.0.0.1 I started to receive the following exception when trying to do a batch insert with ids being generated in the database:

java.lang.AssertionError: autoKeyInfo is not initialized

I created a reproducer for this.

How can I resolve this problem?


Solution

  • This seems to be a bug in the later versions of the Oracle JDBC drivers. They have the findings in the issue tracker, but I have nothing to link to since it is not public.

    The recommended workaround is to use the LTS driver version, which is ojdbc 19.15.0.0.1

    Version 23.3.0.23.09 works fine again.

    Versions tested

    Not working

    • 21.9.0.0
    • 21.6.0.0.1

    Working

    • 19.15.0.0.1
    • 19.18.0.0