If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Insert into 2 tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-09-04, 09:13
TexTwil TexTwil is offline
Registered User
 
Join Date: Feb 2004
Posts: 8
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.
Reply With Quote
  #2 (permalink)  
Old 03-09-04, 09:33
TexTwil TexTwil is offline
Registered User
 
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 ?
Reply With Quote
  #3 (permalink)  
Old 03-09-04, 13:53
TexTwil TexTwil is offline
Registered User
 
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) ?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On