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 can we retrieve data from the resultset?
What are the common tasks of JDBC?
How can you create jdbc statements?
How many ways that we can view a result set?
Is java a database?
What are different parts of a url?
What are the classes and methods used for sending sql statements to database?
Write a program JDBCcode forfetching student database with SQL.
What are the 4 types of jdbc drivers?
Which Java and java.sql data types map to my specific database types?
What is represented by the connection object?
What is jdbc explain?
What causes no suitable driver error?
What does the jdbc connection interface?
How can I manage special characters when I execute an insert query?