What is the result of compiling and executing this code?

Given the code fragment:

Assume that the SQL query matches one record. What is the result of compiling and executing
this code?

Given the code fragment:

Assume that the SQL query matches one record. What is the result of compiling and executing
this code?

A.
The code prints Error.

B.
The code prints the employee ID.

C.
Compilation fails due to an error at line 13.

D.
Compilation fails due to an error at line 14.

Explanation:

The code compiles fine.
A: prints Error: rs.next() fehlt !! Fehlermeldung: Before start of result set
mit rs.next() Aufruf : The code would run fine.
public int getInt(String columnName)
throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as an int
in the Javaprogramming language



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Humberto Bañuelos Flores

Humberto Bañuelos Flores

SQL Exception: java.sql.SQLException: Before start of result set