Java与MySql数据类型对照表
类型名称 |
显示长度 |
数据库类型 |
JAVA类型 |
VARCHAR |
L+N |
VARCHAR |
java.lang.String |
CHAR |
N |
CHAR |
java.lang.String |
BLOB |
L+N |
BLOB |
java.lang.byte[] |
TEXT |
65535 |
VARCHAR |
java.lang.String |
INTEGER |
4 |
INTEGER UNSIGNED |
java.lang.Long |
TINYINT |
3 |
TINYINT UNSIGNED |
java.lang.Integer |
SMALLINT |
5 |
SMALLINT UNSIGNED |
java.lang.Integer |
MEDIUMINT |
8 |
MEDIUMINT UNSIGNED |
java.lang.Integer |
BIT |
1 |
BIT |
java.lang.Boolean |
BIGINT |
20 |
BIGINT UNSIGNED |
java.math.BigInteger |
FLOAT |
4+8 |
FLOAT |
java.lang.Float |
DOUBLE |
22 |
DOUBLE |
java.lang.Double |
DECIMAL |
11 |
DECIMAL |
java.math.BigDecimal |
BOOLEAN |
1 |
同TINYINT |
java.lang.Boolean |
DATE |
10 |
DATE |
java.sql.Date |
TIME |
8 |
TIME |
java.sql.Time |
DATETIME |
19 |
DATETIME |
java.sql.Timestamp |
TIMESTAMP |
19 |
TIMESTAMP |
java.sql.Timestamp
|
转载:http://ju.outofmemory.cn/entry/22288