• 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

Generated keys not requested. You need to specify Statement.RETURN_GENERATED_KEYS to Statement.execu

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am trying to get the id of the inserted record with the use of getGeneratedKeys. but I am getting this error



How can I specify the Statement.RETURN_GENERATED_KEYS in the case of prepRoutesInsert.executeUpdate(); to get the id of the inserted raw?

I appreciate any help.

 
Alex Ardoin
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have change this line to



but I am getting " Column 'route_id' not found"? I have this coulmn in the routes table!
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please show us the details of that table.
 
Alex Ardoin
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does INT(11) mean? Look here.
Why are you using an INT rather than a BIGINT for your primary key?

Still don't know why you aren't getting the route_id column back. Try select * from route at the command line.
 
Alex Ardoin
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am used to use it like this INT(11). It means Integer number with the long of 11 bit.

Like this I am geting the route_id back but I want to get the one of the inserted raw and not all the route_id in the routes table.


 
Alex Ardoin
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have changed this line



to



and I am getting it back now.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

alex friday wrote: . . . It means Integer number with the long of 11 bit. . . .

If it is really 11 bits, that is far too few for your bus numbers. You will run out after 1023 and get an overflow error.

I thought it meant 11 decimal digits, but you can't fill 11 decimal digits with an INT.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic