Sounds as if you need a stored procedure, and a transaction. You will need to read any standard databasees book,
Other members may be better able to help than me, but it goes something like this:-
See whether that helps. To call the procedure, you say "CALL multiple_insert('Rudresh Kumar', '123 High St', 123.45);"
You need to check carefully depending which database you are using; the syntax seems to vary slightly; you might say "execute" instead of "call," or "begin transaction" instead of "start."
References? The Java Tutorial includes stored procedures and transactions. I haven't found any other good stored procedure tutorials; this is probably the least bad. Philip Greenspun explains why you need ACID transactions here, and MySqL have a tutorial here.
Stored procedures will not help you with that. They are a mechanism to run code inside the database, on the database server. I would not advise to commit inside a stored procedure. It might surprise java developers who are trying to rollback. They think that they rolled back to were they started the transaction, but they are only rolling back to after the stored procedure (Applying the Rule of Least Surprise).
Regards, Jan [ May 12, 2007: Message edited by: Jan Cumps ]