File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes auto increment a number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "auto increment a number" Watch "auto increment a number" New topic

auto increment a number

avijit shaw

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
author & internet detective

Joined: May 26, 2003
Posts: 33124

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.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: auto increment a number
It's not a secret anymore!