Insert values in child table

Hi all,In my first.jsp iam inserting values to the master table and in the second.jsp i am inserting values to the child table..My issue is how to get the auto-incremented value of the master table for inserting in child table?
[248 byte] By [a1ba] at [2007-11-27 4:44:54]
# 1
You're talking about JDBC + SQL? If so, for most databases you can use (Prepared)Statement#getGeneratedKeys(). For certain databases, like PostgreSQL and Oracle, you have to write a specific query to retrieve the current sequence.
BalusCa at 2007-7-12 9:57:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thanks for ur replyMy db is MySQL..Could u say me a bit in detail...
a1ba at 2007-7-12 9:57:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
You have to define the column as auto_increment in the DDL. Then, after the Insert query, you can use getGeneratedKeys() of the same Statement or PreparedStatement to retrieve the last insert ID.
BalusCa at 2007-7-12 9:57:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...