wood burning stoves 2.0*
The moose likes JDBC and the fly likes auto increment a number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "auto increment a number" Watch "auto increment a number" New topic
Author

auto increment a number

avijit shaw
Greenhorn

Joined: Oct 24, 2008
Posts: 1
hi all,


i want to auto increment a field of my database(say id field) using java code.
i have a insert form in jsp page, by click on the submit button it will insert the value.
but he thing is thatin my table i have two fields id and name.but in in the form there is only one foeld that is name.whenever i insert a name and submit,
the id field of the database auto generate d a number and incremented by one on every post action....


how to do???

plzzzz solve this.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

Avijit,
Welcome to JavaRanch!

If the database is generating the key, you just need to insert the name. The database will take care of the id for you.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
 
subject: auto increment a number
 
Similar Threads
Regarding Database Transction sychronisation
how to know the last auto-increment number using JDBC
How to insert autoincrement value?
Insert Query with auto-incrementing key
how to automatically generate a sequence of numbers