You can create a connection object with auto commit turned off. Then pass
that connection along with your ParentTableID to the child update code as
session vars. When all updates to database are successful, commit all
transactions.
robert young <[EMAIL PROTECTED]>
Sent by: "A mailing list for discussion about Sun Microsystem's
Java Servlet API
Technology." <[EMAIL PROTECTED]>
04/10/01 04:28 PM
Any replies will be addressed to: "A mailing list for discussion
about Sun Microsystem's Java
Servlet API Technology."
To: [EMAIL PROTECTED]
cc:
Subject: OFF-TOPIC: using JDBC to update parent/child
tables
[since there is no JDBC e-mail group, i'll try here]
i need to use JDBC (dynamic SQL, not stored procedures),
to insert a parent table row, then one or more child
table rows where parent table Id is written into a
column (e.g. ParentTableID) in the child table rows,
thus supporting joining the two tables.
while i can do this with ease using a bulk update where
i can generate the id's as variables without reference
to the underlying tables, i need to do this at the request
of a servlet, getting data passed in. i'm using db2, which
can produce an integer primary key on the fly. the passed
in data from the servlet is not sufficient to make a unique
identifier for the parent table row, so i need to use
either the db2 facility, or a managed control table.
single table inserts aren't a problem with JDBC, but this
related table stuff has got me flummoxed.
thanx,
robert young
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html