• 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

use of serail key (auto increment)

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
the problem is when we have a serial key in the database, and when we insert a record in that table, how do we access it back. u don't know the value of hte serial key when u insert a record in the table, it is assigned by the database itself.
the problem has some solution in the JDBC driver for the corresponding drivers. e.g. the informix JDBC driver gives specific api to get back the value of the serial field and this works fine in normal scenario. but when we are trying to use the weblogic connection pool, the method given by informix api are not avialable. ( the connection and statement classes are totaly different than the informix respectives, even though the driver specified is the informix JDBC driver.)
can nyone tell me how to overcome this problem?
 
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might have to write a stored procedure to return the last index. I don't know informix though, so I don't know what is possible.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may or may not help.
This is supported in JDBC 3.0.
See the section named 'auto-generated keys' in this article.
Getting upto date with JDBC
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kel Walker:
This may or may not help.
This is supported in JDBC 3.0...


Unfortunately, I haven't seen 1 JDBC 3.0 compliant driver yet.
Oracle will increment the auto number (sequence) on a select using the sequence to obtain it's value, then use the value to write to the database.
You can also handle the autonumber in a class by yourself. If you search the forum, it has been explained in detail in a previous thread.
Jamie
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic