Answer Posted / sanjeev gupta
Callable Statemnt Example:- Here we prsent a stored
procedure fetuser(int userid) taht takes user id as
parameter and returns the first_name and last_name column
of the user.
try {
CallableStatement callablestmt =
con.prepareCall("{call fetchuser(?)}");
callablestmt.setInt(1,1);
ResultSet rs1 = callablestmt.executeQuery();
while(rs1.next())
{
String fname = rs1.getString("FIRST_NAME");
String lname = rs1.getString("LAST_NAME");
out.println(fname+" "+lname+ "<br />");
}
} catch (SQLException e) {
e.printStackTrace();
}
| Is This Answer Correct ? | 21 Yes | 6 No |
Post New Answer View All Answers
What is meant by connection string?
What are the differences between execute, executequery, and executeupdate?
Which package is used for jdbc application?
What are the benefits of PreparedStatement over Statement?
Which database is used with java?
Differentiate between stored procedure and functions?
What is jdbc odbc bridge?
What does the jdbc resultset interface?
What are devices?
What are the differences between stored procedure and functions?
What is the full form of jdbc and what is its purpose?
How do I check in my code whether a maximum limit of database connections have been reached?
What is the most common example type 1 driver?
How to use JDBC API to call Stored Procedures?
What is sqlwarning and discuss the procedure of retrieving warnings?