sql中的类型对应java中的数据类型一览表

sql type—java type数据关系

SQL Data Type JAVA Data Type
bigint BIGINT
binary BINARY
bit BIT
char CHAR
datetime TIMESTAMP
decimal ECIMAL
float FLOAT
image LONGVARBINARY
int INTEGER
money DECIMAL
nchar CHAR
ntext LONGVARCHAR
numeric NUMERIC
nvarchar VARCHAR
real REAL
smalldatetime TIMESTAMP
smallint SMALLINT
smallmoney DECIMAL
sql_variant VARCHAR
sysname VARCHAR
text LONGVARCHAR
timestamp BINARY
tinyint TINYINT
uniqueidentifier CHAR
varbinary VARBINARY
varchar VARCHAR

下面是jdbc data type和java data type之间的mapping:

JDBC Type Java Type
CHAR String
VARCHAR String
LONGVARCHAR String
NUMERIC java.math.BigDecimal
DECIMAL java.math.BigDecimal
BIT boolean
BOOLEAN boolean
TINYINT byte
SMALLINT short
INTEGER int
BIGINT long
REAL float
FLOAT double
DOUBLE double
BINARY byte[]
VARBINARY byte[]
LONGVARBINARY byte[]
DATE java.sql.Date
TIME java.sql.Time
TIMESTAMP java.sql.Timestamp
CLOB Clob
BLOB Blob
ARRAY Array
DATALINK java.net.URL
JAVA_OBJECT underlying Java class

你可能感兴趣的:(java,数据库,mysql,数据库)