Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Overhead with executing a stored procedure using CallableStatement

9 views
Skip to first unread message

Rohit

unread,
May 28, 2009, 4:56:01 PM5/28/09
to
When I execute a stored procedure using a CallableStatement, the sp_prepexec
statement is called. And later when I close the statement, the sp_unprepare
is called. This seems to be the default behavior of the JDBC driver. The
problem is, the overhead to generate a prepared statement and then close it
has performance impact. Is there a way for the driver to execute the stored
procedure directly?

I am using SQL Server JDBC Driver 2.0 with SQL Server 2005.

Thanks,
Rohit

Adam Saxton [MSFT]

unread,
Oct 6, 2009, 3:45:21 PM10/6/09
to
Sorry this took so long to get a response out. If you do not want to incur
the PreparedStatement call to the Engine, you can use a regular statement
in your Java Code. This would mean that you are not using any parameters
as well. The following in the JDBC Driver help illustrates this

Using a Stored Procedure with No Parameters
http://msdn.microsoft.com/en-us/library/ms378917.aspx

The following documentation shows different ways that you can call Stored
Procedures using our driver.

Using Statements with Stored Procedures
http://msdn.microsoft.com/en-us/library/ms378046.aspx

Thanks,
Adam

0 new messages