Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

17.8.1 Mapping SQL data types

There is not an exact match between HiRDB's SQL data types and JDBC's SQL data types. For this reason, the JDBC driver performs mapping (conversion) between JDBC's SQL data types and the SQL data types of the HiRDB to be connected. If an unmappable SQL data type is used for data access, the JDBC driver throws an SQLException. If an SQL statement that uses HiRDB's ROW type, which cannot be mapped to any of JDBC's SQL data types, is executed for an HiRDB server that uses little endian, the JDBC driver throws an SQLException that includes the KFPA11104-E message indicating a syntax error.

The SQL data types are mapped with getXXX and setXXX methods of the ResultSet and PreparedStatement classes. For details about the mapping rules for the SQL data types and the getXXX and setXXX methods, see the documentation for the JDBC1.0 standard and JDBC2.0 basic standard.

Table 17-30 shows the correspondences between the SQL data types of HiRDB and JDBC.

Table 17-30 SQL data type correspondences between HiRDB and JDBC (Type4 JDBC driver)

HiRDB's SQL data type JDBC's SQL data type
INTEGER INTEGER
SMALLINT SMALLINT
DECIMAL, NUMERIC DECIMAL (NUMERIC)#1
FLOAT, DOUBLE PRECISION FLOAT (DOUBLE)#1
SMALLFLT, REAL REAL
CHAR CHAR
VARCHAR VARCHAR (LONGVARCHAR)#1
NCHAR CHAR
NVARCHAR VARCHAR (LONGVARCHAR)#1
MCHAR CHAR
MVARCHAR VARCHAR (LONGVARCHAR)#1
DATE DATE
TIME TIME
BLOB LONGVARBINARY (BINARY, VARBINARY, BLOB)#1
BINARY LONGVARBINARY (BINARY, VARBINARY, BLOB)#1
TIMESTAMP TIMESTAMP
BOOLEAN#2 BIT

#1
The data types shown in parentheses are supported only when JDBC's SQL data types are specified in the arguments of the setNull or setObject method. They are not supported during mapping from HiRDB's SQL data types to JDBC's SQL data types.

#2
This refers to a BOOLEAN column in a ResultSet object that is generated by the getTypeInfo method of DatabaseMetaData.