Which of the following code segments would run the stored procedure "getPassword()" on a database server?
A. CallableStatement cs = connection.prepareCall("call.getPassword()"); cs.executeQuery();
B.Callable
C. callable = conn.prepareCall("call getPassword()"); callable.executeUpdate();
D. Declarable Statement cstate = connect.prepareCall("call getpassword()"); cstate.executeQuery();
Answer:C
Which of the following code segments would run the stored procedure "getPassword()" on a database server?
A. CallableStatement cs = connection.prepareCall("call.getPassword()"); cs.executeQuery(); B.Callable C. callable = conn.prepareCall("call getPassword()"); callable.executeUpdate(); D. Declarable Statement cstate = connect.prepareCall("call getpassword()"); cstate.executeQuery();
Explanation: java.sql is a class in Java. The CallableStatement interface is used to invoke SQL stored procedures in the database. Stored procedures are similar to functions in that they perform specific tasks, but they are only available in the database. The CallableStatement might return a single ResultSet object or several ResultSet objects. CallableStatement cab = con.prepareCall("call getPassword()"); cab.executeQuery();