• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error using SCOPE_IDENTITY in java code

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic