8.3.12 executeQuery(String sql)
- Organization of this subsection
(1) Function
This method executes a retrieval SQL statement and returns a ResultSet object containing the retrieval result.
(2) Format
public synchronized ResultSet executeQuery(String sql) throws SQLException
(3) Arguments
- String sql
-
Specifies the SQL statement (retrieval SQL statement) that is to be executed.
(4) Return value
The method returns a ResultSet object containing the retrieval result.
(5) Exceptions
The JDBC driver throws an SQLException in the following cases:
-
The Statement object is closed.
-
The Connection object that created the Statement object is closed.
-
A non-retrieval SQL statement (such as the INSERT statement) was executed.
-
null or a character string with a length of zero was specified in the sql argument.
-
A database access error occurs.
-
The specified SQL statement exceeds 16,000,000 characters.