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
How do I check in my code whether a maximum limit of database connections have been reached?
What is the difference between jdbc and odbc?
What is connection data?
What does executeupdate return in jdbc?
What is sqlwarning and discuss the procedure of retrieving warnings?
What is represented by the connection object?
Explain about Join?
How to rollback a JDBC transaction?
What is namedparameterjdbctemplate?
What is a merge field?
What is a statement in java?
Compare jdbc and odbc and how is jdbc required in this context.
Prepared statements are faster. Why?
What is jdbc type?
How many types of jdbc drivers are available?