Results 1 to 3 of 3
  1. #1
    Albert is offline Senior Member
    Join Date
    Jun 2007
    Posts
    114
    Rep Power
    0

    Default How to create auto-increment

    Hello, i'm a new coder here and totally a beginner programmer especially in JSP.
    I have a problem how to create auto-increment process in database and also in JSP.
    Could any one here give me some example and step how to create it?

    Thank You.

    Albert:rolleyes:

  2. #2
    Marcus is offline Member
    Join Date
    Jun 2007
    Posts
    92
    Rep Power
    0

    Default

    Auto-increment is usually implemented at the database layer.

    For example, if we have a table in MySQL and it is define as:

    Java Code:
    table users {
    id int(13) not null auto_increment,
    name varchar( 45 ) not null default '',
    email varchar( 55 ) not null default '',
    website varchar( 100 ) not null default '',
    primary key( id )
    }
    As you can see from the above definition, the "id" should be automatically incremented by the database.

    The above statement can be executed the same way outside, or inside a JSP page.

    If you are not sure about JDBC and how it works, here is a good tutorial that demonstrates JDBC connections, data manipulations etc.

    Greetings

    Marcus:cool:

  3. #3
    Albert is offline Senior Member
    Join Date
    Jun 2007
    Posts
    114
    Rep Power
    0

    Default

    How about if the table already exist? It is necessary to create again the table?
    And how about sequence and triggers?
    Help me, please.

    Thanks

    Albert:rolleyes:

Similar Threads

  1. Increment a Variable
    By rhm54 in forum New To Java
    Replies: 2
    Last Post: 06-14-2008, 02:57 AM
  2. Auto Update Function
    By abiieez in forum New To Java
    Replies: 4
    Last Post: 04-16-2008, 04:17 PM
  3. Object ArrayList - increment solution needed badly!!
    By rugbyGeek in forum New To Java
    Replies: 4
    Last Post: 03-08-2008, 12:47 AM
  4. turn off auto compile
    By bugger in forum Eclipse
    Replies: 3
    Last Post: 01-04-2008, 08:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •