File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes multiple statements or in a stored proc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "multiple statements or in a stored proc" Watch "multiple statements or in a stored proc" New topic

multiple statements or in a stored proc

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi All
What is a better apporach to have in a scenario where i have 10 DML (ins/upd/del)to execute.
Whether to use 10 individual statements or have all of them in one stored proc

Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
The solution depends on the architecture of your application. I prefer keeping it in the Java (10 statements), but there are times where you'd use a procedure as well.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33098

You could use JDBC to batch the 10 statements into one database trip. This would provide most of the advantages of a stored procedure while keeping all the code in java.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: multiple statements or in a stored proc
jQuery in Action, 3rd edition