This article talks about Javadata type and MySql data type Comparison table. Shared with everyone for your reference, the details are as follows:
#Type name | ##Display lengthDatabase Type | JAVA Type | JDBC Type Index (int) | |
L+N | VARCHAR | java.lang.String | 12 | |
N | CHAR | ##java.lang.String | 1 | BLOB |
L+N | BLOB | java.lang.byte[] | -4 | ##TEXT |
65535 | VARCHAR | java.lang.String | -1 | INTEGER |
4 | INTEGER UNSIGNED | java.lang.Long | ##4TINYINT | |
TINYINT UNSIGNED | java.lang.Integer | -6 | SMALLINT | |
SMALLINT UNSIGNED | java.lang.Integer | 5 | MEDIUMINT | |
##MEDIUMINT UNSIGNED | java.lang.Integer | 4 | BIT | |
BIT | java.lang.Boolean | -7 | BIGINT | |
BIGINT UNSIGNED | java.math.BigInteger | -5 | FLOAT | ##4+8|
FLOAT | java.lang.Float | 7 | DOUBLE | 22 |
DOUBLE | ##java.lang. Double | 8 | DECIMAL | 11 |
DECIMAL | java.math.BigDecimal | 3 | BOOLEAN | 1 |
Same as TINYINT | ID |
11 |
||
PK (INTEGER UNSIGNED) | java.lang.Long | 4 | DATE | 10 |
DATE | java.sql.Date | 91 | TIME | 8 |
TIME | java.sql.Time | 92 | DATETIME | 19 |
##java.sql.Timestamp | 93 | ##TIMESTAMP | 19 | TIMESTAMP |
java.sql.Timestamp | ##93 | YEAR | 4 | YEAR |
java.sql.Date | 91 |
##For bolb, it is generally used for database storage of pictures. The principle is to convert the picture into binary and then perform a storage method, which corresponds to byte[] array in java. For the boolen type, in mysql database , I personally think it is better to use the int type instead. It is not very convenient for bit operations, especially in projects with web page development, it means 0 /1, which corresponds to the Java type Integer is better. |
The above is the detailed content of Compare Java data types to MySql data types. For more information, please follow other related articles on the PHP Chinese website!