Mysql和Java数据类型对比一览表

    xiaoxiao2021-03-26  3

    Mysql和Java数据类型对比一览表

    2017.1.9

    MySQL Type NameReturn value of GetColumnClassName Returned as Java Class BIT(1) (new in MySQL-5.0)BITjava.lang.Boolean BIT( > 1) (new in MySQL-5.0)BITbyte[]TINYINTTINYINT java.lang.Boolean if the configuration property tinyInt1isBit is set to true (the default) and the storage size is 1, or java.lang.Integer if not. BOOL, BOOLEAN TINYINTSee TINYINT, above as these are aliases for TINYINT(1), currently.SMALLINT[(M)] [UNSIGNED]SMALLINT [UNSIGNED] java.lang.Integer (regardless of whether it is UNSIGNED or not)MEDIUMINT[(M)] [UNSIGNED]MEDIUMINT [UNSIGNED] java.lang.Integer (regardless of whether it is UNSIGNED or not)INT,INTEGER[(M)] [UNSIGNED]INTEGER [UNSIGNED] java.lang.Integer, if UNSIGNED java.lang.Long BIGINT[(M)] [UNSIGNED]BIGINT [UNSIGNED] java.lang.Long, if UNSIGNED java.math.BigInteger FLOAT[(M,D)]FLOATjava.lang.FloatDOUBLE[(M,B)]DOUBLEjava.lang.DoubleDECIMAL[(M[,D])]DECIMALjava.math.BigDecimalDATEDATEjava.sql.DateDATETIMEDATETIMEjava.sql.TimestampTIMESTAMP[(M)]TIMESTAMPjava.sql.TimestampTIMETIMEjava.sql.TimeYEAR[(2|4)]YEARIf yearIsDateType configuration property is set to false, then the returned object type is java.sql.Short. If set to true (the default), then the returned object is of type java.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)BINARYbyte[]VARBINARY(M)VARBINARYbyte[]TINYBLOBTINYBLOBbyte[]TINYTEXTVARCHARjava.lang.StringBLOBBLOBbyte[]TEXTVARCHARjava.lang.StringMEDIUMBLOBMEDIUMBLOBbyte[]MEDIUMTEXTVARCHARjava.lang.StringLONGBLOBLONGBLOBbyte[]LONGTEXTVARCHARjava.lang.StringENUM('value1','value2',...)CHARjava.lang.StringSET('value1','value2',...)CHARjava.lang.String 来自mysql connector/j 5.1官方文档

    MySQL5.7数据类型

    官方文档传送门

    转载请注明原文地址: https://ju.6miu.com/read-500174.html

    最新回复(0)