Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    8

    Unanswered: Insert into 2 tables

    Hi,
    I'm developping a J2EE web based application which uses INFORMIX DB. I have to insert data in 2 tables : CUSTOMER and USER.

    CUSTOMER(id_customer(serial)<pk>, name, mail ..., id_user(int)<fk>)
    and
    USER(id_user(serial)<pk>, login, passwd ...)

    the constraint I have on these tables is of course:
    alter table CUSTOMER
    add constraint foreign key (ID_USER)
    references USER (ID_USER)
    constraint FK_REFEREN_USER;

    I have a web form where the user can fill his information (name, mail, passwd, login ...)

    I'm sure you already know my question.

    Which is the best way to insert these values in both tables and keep them related ?

    thanks a lot for your help,
    cheers.

  2. #2
    Join Date
    Feb 2004
    Posts
    8
    ps:
    I'm in an java environement so I can use the Java APIs. Maybe it is possible to handle this problem with java.sql classes ?

  3. #3
    Join Date
    Feb 2004
    Posts
    8
    isn't there a java function which returns the int of the SERIAL that has just been incremented ?
    something like
    int executeInsert(String query) ?

Posting Permissions

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