0 votes
in JAVA by

Which of the following code segment would execute the stored procedure "getPassword()" located in a database server?

a) CallableStatement cs = connection.prepareCall("{call.getPassword()}");

cs.executeQuery();

b) CallabledStatement callable = conn.prepareCall("{call getPassword()}");

callable.executeUpdate();

c) CallableStatement cab = con.prepareCall("{call getPassword()}");

cab.executeQuery();

d) Callablestatement cstate = connect.prepareCall("{call getpassword()}");

cstate.executeQuery();

1 Answer

0 votes
by

(c) CallableStatement cab = con.prepareCall("{call getPassword()}");
cab.executeQuery();

reason: In Java, java.sql.CallableStatement interface is used to call the SQL stored procedures in the database. The stored procedures are similar to functions as they perform some specific tasks, except that they are only available in the database. The CallableStatement can return either a single ResultSet object or multiple ResultSet objects.

Related questions

0 votes
asked Apr 9, 2021 in JAVA by Robindeniel
0 votes
asked Apr 8, 2021 in JAVA by SakshiSharma
...