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 databasemetadata interface?
What is difference between odbc and jdbc?
Explain about column name and getter method?
What is in term of jdbc a datasource?
What is the meaning of connection?
How can you use preparedstatement in jdbc?
How can I manage special characters when I execute an insert query?
Does the database server have to be running Java or have Java support in order for my remote JDBC client app to access the database?
What are jdbc and its components?
What is the benefit of having jdbcrowset implementation? Why do we need a jdbcrowset like wrapper around resultset?
What are the differences between execute, executequery, and executeupdate?
When do we use execute method in java jdbc?
How can I use the JDBC API to access a desktop database like Microsoft Access over the network?
What is jdbc thin client?
What are the different types of classes in the api component?