更新时间:2024-06-03 GMT+08:00

JDBC数据类型映射关系

数据类型、JAVA变量类型以及JDBC类型索引关系如下(A:Oracle兼容,B:MY兼容,M:M-Compatibility):

兼容模式

Gauss Kernel数据类型

JAVA变量类型

JDBC类型索引

A/B

oid

java.lang.Long

java.sql.Types.BIGINT

A/B/M

numeric

java.math.BigDecimal

java.sql.Types.NUMERIC

A/B/M

tinyint

java.lang.Integer

java.sql.Types.TINYINT

A/B/M

smallint

java.lang.Integer

java.sql.Types.SMALLINT

A/B/M

bigint

java.lang.Long

java.sql.Types.BIGINT

A/B/M

float4

java.lang.Float

java.sql.Types.REAL

A/B/M

float8

java.lang.Double

java.sql.Types.DOUBLE

A/B/M

char

java.lang.String

java.sql.Types.CHAR

A/B

character

java.lang.String

java.sql.Types.CHAR

A/B

bpchar

java.lang.String

java.sql.Types.CHAR

A/B

character varying

java.lang.String

java.sql.Types.VARCHAR

A/B/M

varchar

java.lang.String

java.sql.Types.VARCHAR

A/B/M

text

java.lang.String

java.sql.Types.VARCHAR

A/B

name

java.lang.String

java.sql.Types.VARCHAR

A/B

bytea

byte[]

java.sql.Types.BINARY

A/B/M

blob

java.sql.Blob

java.sql.Types.BLOB

A/B

clob

java.sql.Clob

java.sql.Types.CLOB

A/B

boolean

java.lang.Boolean

java.sql.Types.BIT

B/M

date

java.sql.Date

java.sql.Types.DATE

A/B/M

time

java.sql.Time

java.sql.Types.TIME

A/B

timetz

java.sql.Time

java.sql.Types.TIME

A/B/M

timestamp

java.sql.Timestamp

java.sql.Types.TIMESTAMP

A/B

smalldatetime

java.sql.Timestamp

java.sql.Types.TIMESTAMP

A/B

timestamptz

java.sql.Timestamp

java.sql.Types.TIMESTAMP

A/B

refcursor

java.sql.ResultSet

java.sql.Types.REF_CURSOR

java.sql.Types.OTHER

-10

M

boolean

java.lang.Integer

java.sql.Types.TINYINT

M

tinyblob

java.sql.Blob

java.sql.Types.BLOB

M

mediumblob

java.sql.Blob

java.sql.Types.BLOB

M

longblob

java.sql.Blob

java.sql.Types.BLOB

M

tinytext

java.lang.String

java.sql.Types.VARCHAR

M

mediumtext

java.lang.String

java.sql.Types.VARCHAR

M

longtext

java.lang.String

java.sql.Types.VARCHAR

M

binary

byte[]

java.sql.Types.BINARY

M

varbinary

byte[]

java.sql.Types.BINARY

M

tinyint unsigned

java.lang.Integer

java.sql.Types.INTEGER

M

smallint unsigned

java.lang.Integer

java.sql.Types.INTEGER

M

mediumint unsigned

java.lang.Integer

java.sql.Types.INTEGER

M

integer unsigned

java.lang.Long

java.sql.Types.BIGINT

M

bigint unsigned

java.math.BigInteger

java.sql.Types.BIGINT

M

mediumint

java.lang.Integer

java.sql.Types.INTEGER

M

integer

java.lang.Integer

java.sql.Types.INTEGER

M

decimal

java.math.BigDecimal

java.sql.Types.NUMERIC

M

dec

java.math.BigDecimal

java.sql.Types.NUMERIC

M

real

java.lang.Double

java.sql.Types.DOUBLE

M

datetime

java.sql.Timestamp

java.sql.Types.TIMESTAMP

M

year

java.sql.Date

java.sql.Types.DATE

M

bit

byte[]

java.sql.Types.BIT