my dog learned polymorphism*
The moose likes JDBC and the fly likes Only one question in Stored procedure. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Only one question in Stored procedure." Watch "Only one question in Stored procedure." New topic
Author

Only one question in Stored procedure.

Shanmugam nagaraj
Ranch Hand

Joined: May 07, 2007
Posts: 76
Hi,

What is the scenario we will use the stored procedure?

I understand that will improve the performance while use the stored procedure and also reduce the application overload.

My Question is like:

1) Even though we use the database connection in our application for using the stored procedure right?

2) Why we are not using like simply connecting to database and execute in the application it self?

Please explain me in detail so I can understand it properly.

Thanks

Shanmugam


Thanks <br />Shanmugam N
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


I understand that will improve the performance while use the stored procedure and also reduce the application overload.

It might do. It will shift the performance overhead from the application to the database, plus (depending on how you implement your SPs) it can wrap operations that would need multiple round tiprs from applciation to database into one trip.


1) Even though we use the database connection in our application for using the stored procedure right?

Not sure what you mean here. Are you asking, do we still need to connect to the database to use the procedure? Yes - how else can you access a database resource?


2) Why we are not using like simply connecting to database and execute in the application it self?

Executing in the applciation? Again, not sure what you mean here. You can't execute stored procedures in the applciation, they are exclusively database objects.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Shanmugam nagaraj
Ranch Hand

Joined: May 07, 2007
Posts: 76
Hi paul,

This is the excellent explanation that what I expected.

Thanks paul...



2) Why we are not using like simply connecting to database and execute in the application it self?

----------------------------------------------------------------------------


Executing in the applciation? Again, not sure what you mean here. You can't execute stored procedures in the applciation, they are exclusively database objects.

-----------------------------------------------------------------
I mean here like, we can also just make database connection and use the statement object to execute our simple query thru our java application right, then what is the need for the Stored procedure.

For each and every query this also hit the database to do the operations, please explain me in detail

Thanks
Shanmuam N
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38107
    
  22
Why don't you process the procedure from the application end?

That introduces tight coupling between the database and the distant application; if there is any change in the structure (logical schema) of the DB, any applications using that DB have to be altered. A source of excess work expense and scope for errors.
Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
There's a wealth of information regarding your question.

Google for "benefits/advantages of stored procedures" and you should see some very useful results.

Sashi
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

Google for "disadvantages of stored procedures" and you will also get useful results.

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Shanmugam nagaraj
Ranch Hand

Joined: May 07, 2007
Posts: 76
Wow..
The answer you replied is really cleared my doubts in stored procedure

Thanks to all....
meet you soon with another question be ready ;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Only one question in Stored procedure.
 
Similar Threads
Derby and HSQLDB
DAO pattern for stored procedure cal
Stored Procedure DBUnit
Spring JdbcTemplate issue for calling stored procedure
Why use EJBs - why not simple stored procedures