Official documentation link: dev.mysql.comdocrefman5.0enconnector-j-reference-type-conversions.html Mysql official documentation written on the Mysql Data Type and Java Data Type correspondence. For more information, see the official documentation ~~ Table%25.mysqltypestojavatypesforresultset. getObjec
Official documentation link: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-type-conversions.html Mysql official documentation written on the Mysql Data Type and Java Data Type correspondence. For more information, see the official documentation ~~ Table%25.mysqltypestojavatypesforresultset. getObjec
Official Document link:
Http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-type-conversions.html
The correspondence between Mysql Data Types and Java data types written in the Mysql official documentation. For more information, see the official documentation ~~
Table 20.25. MySQL Types to Java Types for ResultSet. getObject ()
MySQL Type Name |
Return value ofGetColumnClassName |
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 |