您好,欢迎访问一九零五行业门户网

Java&MySQL Type Mapping_MySQL

mysql type name
return value of
getcolumnclassname
returned as java class
bit(1) (new in mysql-5.0)
bit
java.lang.boolean
bit( > 1) (new in mysql-5.0)
bit
byte[]
tinyint
tinyint
java.lang.boolean if the configuration property tinyint1isbit is set to true (the default) and the storage size is 1, orjava.lang.integer if not.
bool, boolean
tinyint
see tinyint, above as these are aliases fortinyint(1), currently.
smallint[(m)] [unsigned]
smallint [unsigned]
java.lang.integer (regardless ifunsigned or not)
mediumint[(m)] [unsigned]
mediumint [unsigned]
java.lang.integer, if unsignedjava.lang.long (c/j 3.1 and earlier), orjava.lang.integer for c/j 5.0 and later
int,integer[(m)] [unsigned]
integer [unsigned]
java.lang.integer, if unsignedjava.lang.long
bigint[(m)] [unsigned]
bigint [unsigned]
java.lang.long, if unsignedjava.math.biginteger
float[(m,d)]
float
java.lang.float
double[(m,b)]
double
java.lang.double
decimal[(m[,d])]
decimal
java.math.bigdecimal
date
date
java.sql.date
datetime
datetime
java.sql.timestamp
timestamp[(m)]
timestamp
java.sql.timestamp
time
time
java.sql.time
year[(2|4)]
year
if yearisdatetype configuration property is set to false, then the returned object type isjava.sql.short. if set to true (the default), then the returned object is of typejava.sql.date with the date set to january 1st, at midnight.
char(m)
char
java.lang.string (unless the character set for the column is binary, then byte[] is returned.
varchar(m) [binary]
varchar
java.lang.string (unless the character set for the column is binary, then byte[] is returned.
binary(m)
binary
byte[]
varbinary(m)
varbinary
byte[]
tinyblob
tinyblob
byte[]
tinytext
varchar
java.lang.string
blob
blob
byte[]
text
varchar
java.lang.string
mediumblob
mediumblob
byte[]
mediumtext
varchar
java.lang.string
longblob
longblob
byte[]
longtext
varchar
java.lang.string
enum('value1','value2',...)
char
java.lang.string
set('value1','value2',...)
char
java.lang.string
其它类似信息

推荐信息