8.5.28 getDate(String columnName, Calendar cal)
- Organization of this subsection
(1) Function
This method acquires in a java.sql.Date object the value in a specified column in the current row of the ResultSet object. The column whose value is to be acquired is specified in the argument.
This method uses a specified calendar to create the appropriate date as a millisecond value.
(2) Format
public synchronized java.sql.Date getDate(String columnName, Calendar cal) throws SQLException
(3) Arguments
- String columnName
-
Specifies a column name.
- Calendar cal
-
Specifies the calendar in which the time zone for the values stored in the database has been set.
(4) Return value
This method returns a java.sql.Date object containing the column value. For details about the relationship between the retrieval result and the return value, see Table 8‒25: Relationship between the retrieval result and the return value (getDate method).
(5) Exceptions
The JDBC driver throws an SQLException in the following cases:
-
This ResultSet object is closed.
This includes the case where the ResultSet object was closed because the Statement object that created this ResultSet object was closed.
-
The Connection used to create the Statement object that created this ResultSet object has been closed.
-
The ResultSet object has become invalid due to transaction settlement.
-
A nonexistent column name was specified.
-
The data type cannot be acquired by this method.
-
The column value cannot be acquired as java.sql.Date.
-
An error occurred in the JDBC driver.