Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Java Prepared Statement - concurrency and performance

Re: Java Prepared Statement - concurrency and performance

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 13 Dec 1999 13:05:43 -0500
Message-ID: <m4da5s8kbputt6fl7avfvs2j3vffcsv0vt@4ax.com>


A copy of this was sent to nmp93_at_my-deja.com (if that email address didn't require changing) On Mon, 13 Dec 1999 16:35:22 GMT, you wrote:

>According to the Oracle documentation, "...any public static Java
>method can run in the RDBMS as a stored procedure..."
>
>Please correct me if I'm wrong, but doesn't this raise a whole host
>of concurrency issues. If the method is static, Oracle's JVM will use
>the 'same' method for all calls made upon a given stored procedure. In
>a multi-client system there would be the possibility of muddled results
>- or am I missing the point? Why doesn't the Oracle JVM execute each
>stored procedure as a separate object instance/thread???
>

each session gets it own virtual jvm -- their is an instance of each static class for each session that uses it.

>Also, wouldn't a Java Stored Procedure execute quite slowly i.e. you
>have two lots of JDBC overheads, one from the stored procedure to the
>oracle database and the JDBC overhead from using the callable statement
>that calls the stored procedure?
>

no more so than calling a PL/SQL stored procedure that contains embedded SQL calls. Java is just another stored procedure language you can use in addition to PL/SQL. Nothing more, nothing less.

I'll give you cases where java goes faster then plsql and vice versa - they seem to work quite effectively from my experience.

>Might it be more effective to RMI or Socket between the stored
>procedure and the the client or middle tier?
>

no, you still need to get the procedure going in the database -- you would still need to call it. It would be less efficient to use rmi or sockets (and use lots more resources since the call to run the procedure would use a socket or some network resource as it is - you would tend to double or more the number of connections to the database.

>Many thanks in advance.
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.

--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Dec 13 1999 - 12:05:43 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US