what is callable statement?

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


Please Help Members By Posting Answers For Below Questions

How can we retrieve data from the resultset?

547


What are the common tasks of JDBC?

562


How can you create jdbc statements?

530


How many ways that we can view a result set?

531


Is java a database?

494






What are different parts of a url?

499


What are the classes and methods used for sending sql statements to database?

536


Write a program JDBCcode forfetching student database with SQL.

574


What are the 4 types of jdbc drivers?

508


Which Java and java.sql data types map to my specific database types?

534


What is represented by the connection object?

522


What is jdbc explain?

490


What causes no suitable driver error?

538


What does the jdbc connection interface?

534


How can I manage special characters when I execute an insert query?

512