How to call a Stored Procedure from JDBC?

Answer Posted / rama krishna dwadasi

By using CallableStatement we can call a stored Procedure
from JDBC

CallableStatement:- is an interface available in java.sql
package and is extending PreparedStatement interface.
•It is used to execute stored procedures available in the
database.
•Following is the way to create the CallableStatement object.
a)CallableStatement cs = con.prepareCall(sql);
b)CallableStatement cs = con.prepareCall(sql,int,int);
•One CallableStatement object can be used to invoke one
stored procedure only.
•CallableStatement also provides placeholder mechanism
•Following is the way to invoke the stored procedure.
CallableStatement cs = con.prepareCall(“{call p1 (?,?)}”);

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by boolean?

835


Explain an intermediate language?

742


How to declare an arraylist in java?

721


Can we use static class instead of singleton?

834


What is assembly used for?

792


can rmi and corba based applications interact ?

868


What is super?

803


What is downcasting?

817


What is command line argument

963


Write a program to reverse a number in java?

813


Can Exception handling we can handle multiple catch blocks?

850


What is composition in java?

970


What is the difference between throw and throws in java?

801


What does flagged out mean?

818


how we can make a write-only class in java?

797