Home > Database > Mysql Tutorial > body text

Compare Java data types to MySql data types

怪我咯
Release: 2017-03-30 10:09:36
Original
1935 people have browsed it

This article talks about Javadata type and MySql data type Comparison table. Shared with everyone for your reference, the details are as follows:

##Display length Database TypeJAVA TypeJDBC Type Index (int)VARCHARL+NVARCHARjava.lang.String12##CHARBLOB##43TINYINT UNSIGNEDjava.lang.Integer-65SMALLINT UNSIGNEDjava.lang.Integer58120##4+8DOUBLE22##DATETIME##TIMESTAMP19TIMESTAMP
#Type name
N CHAR ##java.lang.String 1
L+N BLOB java.lang.byte[] -4 ##TEXT
65535 VARCHAR java.lang.String -1 INTEGER
4 INTEGER UNSIGNED java.lang.Long TINYINT
SMALLINT
MEDIUMINT
##MEDIUMINT UNSIGNED java.lang.Integer 4 BIT
BIT java.lang.Boolean -7 BIGINT
BIGINT UNSIGNED java.math.BigInteger -5 FLOAT
FLOAT java.lang.Float 7
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
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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!