MyBatis----JdbcType 与Oracle、MySql数据类型对应关系;JdbcType类型和Java类型的对应关系

1. Mybatis JdbcType与Oracle、MySql数据类型对应列表

Mybatis JdbcType Oracle MySql
JdbcType ARRAY
JdbcType BIGINT BIGINT
JdbcType BINARY
JdbcType BIT BIT
JdbcType BLOB BLOB BLOB
JdbcType BOOLEAN
JdbcType CHAR CHAR CHAR
JdbcType CLOB CLOB 修改为TEXT
JdbcType CURSOR
JdbcType DATE DATE DATE
JdbcType DECIMAL DECIMAL DECIMAL
JdbcType DOUBLE NUMBER DOUBLE
JdbcType FLOAT FLOAT FLOAT
JdbcType INTEGER INTEGER INTEGER
JdbcType LONGVARBINARY
JdbcType LONGVARCHAR LONG VARCHAR
JdbcType NCHAR NCHAR
JdbcType NCLOB NCLOB
JdbcType NULL
JdbcType NUMERIC NUMERIC/NUMBER NUMERIC/
JdbcType NVARCHAR
JdbcType OTHER
JdbcType REAL REAL REAL
JdbcType SMALLINT SMALLINT SMALLINT
JdbcType STRUCT
JdbcType TIME TIME
JdbcType TIMESTAMP TIMESTAMP TIMESTAMP/DATETIME
JdbcType TINYINT TINYINT
JdbcType UNDEFINED
JdbcType VARBINARY
JdbcType VARCHAR VARCHAR VARCHAR

注意到, MyBatis的JdbcType中部分没有对应到Oracle和Mysql的数据类型中(或许由于自己遗漏),不过不用担心,后续大家碰到再具体分

2.JdbcType类型和Java类型的对应关系

SQL Server 类型 JDBC 类型 (java.sql.Types) Java 语言类型

bigint

BIGINT

long

timestamp

binary

BINARY

byte[]

bit

BIT

boolean

char

CHAR

String

decimal

money

smallmoney

DECIMAL

java.math.BigDecimal

float

DOUBLE

double

int

INTEGER

int

image

varbinary(max)

LONGVARBINARY

byte[]

varchar(max)

text

LONGVARCHAR

String

nchar

CHAR

NCHAR (Java SE 6.0)

String

nvarchar

VARCHAR

NVARCHAR (Java SE 6.0)

String

nvarchar(max)

ntext

LONGVARCHAR

LONGNVARCHAR (Java SE 6.0)

String

numeric

NUMERIC

java.math.BigDecimal

real

REAL

float

smallint

SMALLINT

short

datetime

smalldatetime

TIMESTAMP

java.sql.Timestamp

varbinary

udt

VARBINARY

byte[]

varchar

VARCHAR

String

tinyint

TINYINT

short

uniqueidentifier

CHAR

String

xml

LONGVARCHAR

SQLXML (Java SE 6.0)

String

SQLXML

time

TIME (1)

java.sql.Time (1)

date

DATE

java.sql.Date

datetime2

TIMESTAMP

java.sql.Timestamp

datetimeoffset (2)

microsoft.sql.Types.DATETIMEOFFSET

microsoft.sql.DateTimeOffset

JDBC Type           Java Type  
CHAR                String  
VARCHAR             String  
LONGVARCHAR         String  
NUMERIC             java.math.BigDecimal  
DECIMAL             java.math.BigDecimal  
BIT                 boolean  
BOOLEAN             boolean  
TINYINT             byte  
SMALLINT            short  
INTEGER             int  
BIGINT              long  
REAL                float  
FLOAT               double  
DOUBLE              double  
BINARY              byte[]  
VARBINARY           byte[]  
LONGVARBINARY       byte[]  
DATE                java.sql.Date  
TIME                java.sql.Time  
TIMESTAMP           java.sql.Timestamp  
CLOB                Clob  
BLOB                Blob  
ARRAY               Array  
DISTINCT            mapping of underlying type  
STRUCT              Struct  
REF                 Ref  
DATALINK            java.net.URL

3、 Mybatis JdbcType官方文档

Mybatis JdbcType官方文档

 

你可能感兴趣的:(Mybatis,MyBatis-Plus,mysql,oracle,java)