Re: bind variables from java code

From: hayt <hayt_at_inwind.it>
Date: 27 May 2003 02:10:41 -0700
Message-ID: <11f54ca0.0305270110.487fb238_at_posting.google.com>


rs_arwar_at_hotmail.com (Rauf Sarwar) wrote in message
> Good test. It's always a good idea to verify for yourself before
> taking someone else's word for it.
>
> HOWEVER, you forgot one thing, you are doing the same thing in both
> callWithoutParameters() and callWithParameters(). You are making the
> jdbc driver send the statement to the database to compile each time
> you call it. Read small example in my first post.
>
Yes, I know: you are right. Of course is faster if I reuse all times a compiled-once statement. But in my case I cannot reuse the same statement, because the SP calls are performed through a connection pool, and I cannot release a pooled connection without close the statement.
By the way, my question remains: why is (a bit) faster the compilation/execution if a stored procedure when the variables are embedded in the string?
> Furthermore, replace CallableStatement with PreparedStatement and
> test. You would notice that callWithoutParameters() will give you even
> better performance then CallableStatement and callWithParameters()
> will give you poorer performance then CallableStatement... although
> difference may not be a lot.
But if I replace the CallableStatement with a PreparedStatement, how can I get the SP output parameters?
> Regards

You too, and thanks a lot.
Hayt Received on Tue May 27 2003 - 11:10:41 CEST

Original text of this message