need help: simple inser code

I have a mysql db. I have 2 tables. To keep it simple:

contacts

*********

person_id (primary key)

name

address

messages

************

message_id (primary key)

person_id (foreign_key)

text

I'm getting information from a CSV file which I successfully extracted. I know have a String[][] will all the information.

What I want now, is to insert those informations into the database with stored procedures. Here I'm having my troubles.

It works great to insert data in one table or the other. But how do I set messages.person_id ?

Hope that's enough to be a valid question!? ;-)

[667 byte] By [sockena] at [2007-10-2 12:24:05]
# 1
OK, I found it out..Have to make a subquery like this:insert into messages(person_id,text) values ((select person_id from contacts where name = ?),?)Thanks anyways...
sockena at 2007-7-13 9:16:02 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...