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 jdbc and jdbc drivers?
How do I find ojdbc jar version?
What are the different classes through which JDBC represents statements?
Explain the role of driver in jdbc.
Explain the necessary steps to connect to the database in java?
Why do we need jdbc?
Write an sql to find all records having all numeric characters in a field ?
Which jdbc driver is the fastest driver?
How can I connect mysql or oracle with java?
What are the measures to connect to the db using jdbc?
How can we store and retrieve images from the database?
How will you perform truncation using JDBC?
What does the jdbc resultsetmetadata interface?
What is the significance of DataBaseMetaData.tableIndexStatistics? How to obtain and use it?
What are jdbc?