Answer Posted / gajendra
We can use CallableStatement interface to call a stored
procedure.Use the following steps.
1. crate the escape syntax like
String sql="{call procname(?,?,?);
2.CallableStatement cst=con.prepareCall(sql);
3.Set the inparameters using setXXX methods like
cst.setInt(1,10);
cst.setString(2,"abc");
4.Register the out parameter
cst.registerOutParameter(1,Types.Float);
5.Submit the statement using
cst.execute();
6. We can get the data from stored procedure using getXXX
methods
| Is This Answer Correct ? | 4 Yes | 4 No |
Post New Answer View All Answers
Why is singleton class used?
If a class is declared without any access modifiers, where may the class be accessed in java programming?
What is a qualifier in a sentence?
What is intern method in java?
What is the difference between hashmap and hashtable? What is an interface?
Is array a class in java?
What comes to mind when someone mentions a shallow copy in java?
What is the difference between I ++ and ++ I in java?
How many arguments can a method have java?
Explain the features of interfaces in java?
What is the difference between checked exception and unchecked exception?
What is the difference between variable & constant?
How can we use primitive data types as objects?
Can you explain the final method modifier?
Is it necessary that each try block must be followed by a catch block?