8.5.42 getObject(String columnName)
- Organization of this subsection
(1) Function
This method acquires as Object in the Java programming language 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.
(2) Format
public synchronized Object getObject(String columnName) throws SQLException
(3) Arguments
- String columnName
-
Specifies a column name.
(4) Return value
This method returns the column value as a Java object. For details about the relationship between the retrieval result and the return value, see Table 8‒30: Relationship between the retrieval result and the return value (getObject method).
This Java object has the default Java object type that corresponds to the column's SQL type based on the mapping of built-in types specified in the JDBC specifications.
(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.
-
An error occurred in the JDBC driver.