1

now java stored procedures are written in java as the name suggests, therefore they exists on client side. SQL stored procedures exist on the server. I know of advantages in having sql stored procedures:- One that i can think of is reduced network overheads because you only have to send the parameters instead of the whole sql statement.

But i cannot think of any use of having java stored procedures over sql stored procedure . Could someone please help me on this ?

4
  • 1
    What is a Java stored procedure? Can you show the code? As far as I know, then name stored procedure is specific to queries stored on the Database. Commented Jul 12, 2012 at 18:07
  • Oracle allows for stored procedures written in Java. They are executed in a JVM inside Oracle itself. Commented Jul 12, 2012 at 18:09
  • And are you sure your Java stored procedures are 'client side'? Most RDBMSs allow SPs to be defined in a number of different languages. Additionally, allowing any actual client-side code to directly touch your database (as would be required for a SP) is a HUGE security problem. Commented Jul 12, 2012 at 18:09
  • @ThorbjørnRavnAndersen - I see. Like SQL/CLR with SQL Server. Commented Jul 12, 2012 at 18:10

2 Answers 2

1

One big advantage of using Java code only is that its easier to release and version. If you use stored procedures its not as easy to upgrade and roll back versions or run multiple versions concurrently.

Sign up to request clarification or add additional context in comments.

6 Comments

It depends on how much you can cache the data. The more you can cache, the better it is to use Java, the less you can cache the better it is to keep the data in the database. Note: you can send SQL to the database without using any stored procedures.
In java stored procedures, shouldn't the SQL statement be sent to the database?
If the data is cached in Java, the code can execute entirely in Java.
Yeah but for new ones it needs to send the sql query to the server. Apart from this drawback are there anymore ?
The code for the stored procedures and the scripts to install it, can and should be versioned. Essentially you should be able to start from zero with what's in your version control system.
|
0

It's written in Java, which some people prefer to SQL. It's just another way of consolidating the languages used in a project.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.