• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Carey Brown
  • Frits Walraven

Error using SCOPE_IDENTITY in java code

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
Posts: 25420
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.
Popeye has his spinach. I have this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
    Bookmark Topic Watch Topic
  • New Topic