Updated on 2024-08-20 GMT+08:00

JDBC Data Type Mapping

The relationships among data types, Java variable types, and JDBC type indexes are as follows (ORA: Oracle-compatible; MYSQL: MySQL-compatible).

Compatibility Mode

GaussDB Data Type

Java Variable Type

JDBC Type Index

ORA/MYSQL

oid

java.lang.Long

java.sql.Types.BIGINT

ORA/MYSQL

numeric

java.math.BigDecimal

java.sql.Types.NUMERIC

ORA/MYSQL

tinyint

java.lang.Integer

java.sql.Types.TINYINT

ORA/MYSQL

smallint

java.lang.Integer

java.sql.Types.SMALLINT

ORA/MYSQL

bigint

java.lang.Long

java.sql.Types.BIGINT

ORA/MYSQL

float4

java.lang.Float

java.sql.Types.REAL

ORA/MYSQL

float8

java.lang.Double

java.sql.Types.DOUBLE

ORA/MYSQL

char

java.lang.String

java.sql.Types.CHAR

ORA/MYSQL

character

java.lang.String

java.sql.Types.CHAR

ORA/MYSQL

bpchar

java.lang.String

java.sql.Types.CHAR

ORA/MYSQL

character varying

java.lang.String

java.sql.Types.VARCHAR

ORA/MYSQL

varchar

java.lang.String

java.sql.Types.VARCHAR

ORA/MYSQL

text

java.lang.String

java.sql.Types.VARCHAR

ORA/MYSQL

name

java.lang.String

java.sql.Types.VARCHAR

ORA/MYSQL

bytea

byte[]

java.sql.Types.BINARY

ORA/MYSQL

blob

java.sql.Blob

java.sql.Types.BLOB

ORA/MYSQL

clob

java.sql.Clob

java.sql.Types.CLOB

ORA/MYSQL

boolean

java.lang.Boolean

java.sql.Types.BIT

MYSQL

date

java.sql.Date

java.sql.Types.DATE

ORA/MYSQL

time

java.sql.Time

java.sql.Types.TIME

ORA/MYSQL

timetz

java.sql.Time

java.sql.Types.TIME

ORA/MYSQL

timestamp

java.sql.Timestamp

java.sql.Types.TIMESTAMP

ORA/MYSQL

smalldatetime

java.sql.Timestamp

java.sql.Types.TIMESTAMP

ORA/MYSQL

timestamptz

java.sql.Timestamp

java.sql.Types.TIMESTAMP

ORA/MYSQL

refcursor

java.sql.ResultSet

java.sql.Types.REF_CURSOR

java.sql.Types.OTHER

-10