8.6.43 getObject(int columnIndex)
- 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(int columnIndex) throws SQLException
(3) Arguments
- int columnIndex
-
Specifies a column number.
(4) Return value
This method returns the column value as a Java object.
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.
The following table shows the relationship between the retrieval result and the return value.
|
HADB data type |
Retrieval result |
Return value |
|---|---|---|
|
ARRAY |
Null value |
null |
|
Other |
Array object that stores the retrieval result |
|
|
CHAR VARCHAR STRING |
Null value |
null |
|
Other |
Retrieval result |
|
|
SMALLINT#2 |
Null value |
null |
|
Other |
Short object created from the retrieval result |
|
|
INTEGER#3 |
Null value |
null |
|
Other |
Integer object created from retrieval result |
|
|
BIGINT |
Null value |
null |
|
Other |
Long object created from retrieval result |
|
|
DECIMAL NUMERIC |
Null value |
null |
|
Other |
Retrieval result |
|
|
REAL |
Null value |
null |
|
Other |
Float object created from the retrieval result |
|
|
DOUBLE PRECISION FLOAT |
Null value |
null |
|
Other |
Double object created from retrieval result |
|
|
DATE |
Null value |
null |
|
Other |
java.sql.Date object created from retrieval result |
|
|
TIME |
Null value |
null |
|
Other |
java.sql.Time object created from retrieval result |
|
|
TIMESTAMP WITHOUT TIME ZONE |
Null value |
null |
|
Other |
java.sql.Timestamp object created from retrieval result |
|
|
TIMESTAMP WITH TIME ZONE |
Null value |
null |
|
Other |
java.time.OffsetDateTime object created from retrieval result |
|
|
BINARY VARBINARY |
Null value |
null |
|
Other |
Retrieval result |
|
|
UUID |
Null value |
null |
|
Other |
java.util.UUID object created from retrieval result |
|
|
ROW |
Non-null value#1 |
Retrieval result |
|
BOOLEAN |
Null value |
null |
|
Non-null value |
Boolean object created from retrieval result |
- #1
-
A retrieval result cannot be a null value.
- #2
-
If the integer data type format is in legacy format, the Integer object is returned.
- #3
-
If the integer data type format is in legacy format, the Long object is returned.
(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 number was specified.
-
An error occurred in the JDBC driver.