My Oracle Support Banner

Connector J Error: "java.sql.SQLException: Generated keys not requested" (Doc ID 1382309.1)

Last updated on FEBRUARY 03, 2019

Applies to:

MySQL Connectors - Version 5.1 and later
Information in this document applies to any platform.

Symptoms

Sometimes upgrading Connector/J to a new version (spotted with 5.1.18) can cause the following exception (especially if the client program code is old):

Caused by: java.sql.SQLException: Generated keys not requested. You need to specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate() or Connection.prepareStatement().

Changes

From Connector/J 5.1.7 onward (Bug #11747826), an exception is now thrown when getGeneratedKeys() is called on a statement that had not been created with RETURN_GENERATED_KEYS.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.