Hitachi

Hitachi Advanced Database Application Development Guide


8.5.41 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.

Table 8‒30: Relationship between the retrieval result and the return value (getObject method)

HADB data type

Retrieval result

Return value

CHAR

VARCHAR

Null value

null

Other than the above

retrieval-result

SMALLINT

Null value

null

Other than the above

Integer object created by using the retrieval result

INTEGER

Null value

null

Other than the above

Long object created by using the retrieval result

DECIMAL

Null value

null

Other than the above

retrieval-result

DOUBLE PRECISION

Null value

null

Other than the above

Double object created by using the retrieval result

DATE

Null value

null

Other than the above

java.sql.Date object created by using the retrieval result

TIME

Null value

null

Other than the above

java.sql.Time object created by using the retrieval result

TIMESTAMP

Null value

null

Other than the above

java.sql.Timestamp object created by using the retrieval result

BINARY

VARBINARY

Null value

null

Other than the above

retrieval-result

ROW

Non-null value#1

retrieval-result

BOOLEAN#2

Null value

null

Non-null value

Boolean object created by using the retrieval result

#1

The retrieval result will never be the null value.

#2

BOOLEAN-type data exists when the ResultSet object was created from DatabaseMetadata.

(5) Exceptions

The JDBC driver throws an SQLException in the following cases: