This week's book giveaway is in the Programmer Certification forum. We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
There is another question in the trial whizlabls J2EE 484 simulator which I would like to discuss it here. Moderator(s): In case there are any copyright issues, please feel free to delete this post. 1. You are executing a stored procedure that may return multiple results. Which of the following JDBC methods and interfaces will you use for the purpose? A. execute() method and CallableStatement interface B. execute() method and PreparedStatement interface C. executeQuery() method and CallableStatement interface D. executeQuery() method and PreparedStatement interface E. executeUpdate() method and Statement interface F. executeUpdate() method and PreparedStatement interface Correct Answer : A I checked up the API also, option A is the correct answer. Statement ^ | PreparedStatement ^ | CallableStatement I found the foll. in the JDK1.4 API docs:
public boolean execute(String sql)throws SQLException - Executes the given SQL statement, which may return multiple results. In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string. The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).
But what are multiple result sets? ...I am familiar with a single Result Set. Most of the times, I have used executeQuery() to execute Select statements returning multiple rows and also stored procedures returning a value. Can somebody give me an example of multiple result sets? [ May 06, 2004: Message edited by: Vishwa Kumba ]