Home Java Calling a Stored Procedure with Parameters using Jdbc

Calling a Stored Procedure with Parameters using Jdbc

3 min read

Callable statement consist of three parameters  we used the form with a result parameter, which means that we must set it as an OUT parameter.

To clarify I have numbered the parameters:

Authors is Stored procedure name it takes three parameters.i clearly explain below.

{call authors(?,?,?)}
                      1 2 3
                      In out


Above example takes the first one in IN parameter, the second and third are OUT parameters and returns a result.

Therefore the correct way to call it is:

Create a CallableStatement object to call the store procedure.

 CallableStatement stat1 = con.prepareCall(“{call authors(?,?,?)}”);

Parameter 1 is an IN-only parameter the stored procedure doesn’t return any other value besides the OUT-parameters.

To read the result from the OUT-parameters we also have to adapt the parameter numbers:

i have attach the full Code below.

I have attached the video tutorial below it will help you  to do this  step by step.




Load More Related Articles
Load More By admin
Load More In Java

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

Create Maven project in Intellij

In this tutorial will see how to create Maven project in Intellij step by step. First Step…