Page 1 of 1

is it posible to send multiple DB updates in single request

Posted: 29 Jan 2012, 02:46
by rutabuga
I'm currently looking for the best way to do an insert into on multiple
un-related tables. say for example

INSERT INTO `tbl1` (`name`) VALUES ('MR x');
INSERT INTO `tbl2` (`a number`) VALUES ('1337');

without having to do multiple calls of dbManager.executeUpdate()
is there a way to send multiple sql updates without the use of loop.
and therefore in a single request to the DB vs many requests

something like

dmManager.executeUpdate(update1 + update2 + update3)

Posted: 29 Jan 2012, 18:58
by trueicecold
You could create a stored procedure to hold all of the inserts you need, and with 1 call to the db - run it. However, in the background the database will still run multiple insert queries.