GeeCON Prague 2014*
The moose likes JDBC 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
Bookmark "multiple statements or in a stored proc" Watch "multiple statements or in a stored proc" New topic
Author

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

Rgrds
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
Marshal

Joined: May 26, 2003
Posts: 30596
    
154

Manish,
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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
GeeCON Prague 2014
 
subject: multiple statements or in a stored proc