Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and the fly likes postgresql - How to fix -Returning autogenerated keys is not supported. exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "postgresql - How to fix -Returning autogenerated keys is not supported. exception" Watch "postgresql - How to fix -Returning autogenerated keys is not supported. exception" New topic
Author

postgresql - How to fix -Returning autogenerated keys is not supported. exception

Manoj Raghuwanshi
Ranch Hand

Joined: Jun 20, 2004
Posts: 75
I am using postgresql database. I using sequence as a primary key in a table.
After inserting a row using preparedStatement, I want to know this auto generated id. For this i am using the jdbc 3 method ,
pstmt = conn.prepareStatement(query,
Statement.RETURN_GENERATED_KEYS);

But the postgresql driver is throwing this exception -
Returning autogenerated keys is not supported.
please help me to fix this problem.Thanks in advance.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: postgresql - How to fix -Returning autogenerated keys is not supported. exception
 
Similar Threads
Porting cmp from jboss 3.2.1 to 3.2.3 for postgresql
Initial Context problem
inserted primary key
Best way to generate PK in EJB
Auto Composite key with Id and version