Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error using SCOPE_IDENTITY in java code

 
Kanchan Singh
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I am creating a prepareStatment which has insert query
and the table it inserts generates an auto increment value.
I want this auto increment value using SCOPE_IDENTITY in same query
my code is


where am I making mistake any suggestion..

Thanks in advance
Regards
kanchan
 
Paul Clapham
Sheriff
Pie
Posts: 20758
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, first you create a PreparedStatement using an option that says "Don't return auto-generated keys". Then right after that you use some code that tries to get the auto-generated keys. Looks like an error to me. But there doesn't seem to be anything about SCOPE_IDENTITY in what you posted, so I can't understand why your post title says you are having an error using it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic