[JDBC] SQL & Java Type Matching

728x90

 

Java MySQL Oracle SQL
Boolean BIT RAW
Boolean BOOL / BOOLEAN ( TINYINT(1) ) BOOLEAN
Boolean or
Integer ( if tinyIntisBit = false )
TINYINT NUMBER(3,0)
Integer SMALL / MEDIUM INT [(M)] [UNSIGNED] NUMBER(5,0), NUMBER(7,0)
Integer or Long ( Unsigned ) INT, INTEGER [(M)] [UNSIGNED] INT, INTEGER,  NUMBER(10,0)
Long or
java.math.BigInteger ( Unsigned )
BIGINT [(M)] [UNSIGNED] NUMBER(19,0)
Float FLOAT [(M,D)] REAL, FLOAT
Double DOUBLE [(M,B)] DOUBLE PRECISION, FLOAT(24)
java.math.BigDecimal DECIMAL [(M[,D])] DEC, DECIMAL,
NUMBER, NUMERIC, FLOAT(24)
java.sql.Date DATE DATE
java.sql.Timestamp DATETIME DATE
java.sql.Timestamp TIMESTAMP [(M)] TIMESTAMP
java.sql.Timestamp TIME DATE
Short or
java.sql.Date ( yearsIsDateType )
YEAR [(2|4)] NUMBER
String or byte[] ( Binary ) VAR CHAR (M) [BINARY] CHAR, CHARACTER, LONG,
STRING, VARCHAR, VARCHAR2
byte[] VAR BINARY (M)
byte[] TINY / MEDIUM / LONG BLOB BLOB, RAW
String TINY / MEDIUM / LONG TEXT CLOB, RAW, VARCHAR2
String ENUM VARCHAR2
String SET VARCHAR2
oracle.sql.ROWID
ROWID, UROWID

 

출처 :
MySQL  https://dev.mysql.com/doc/connectors/en/connector-j-reference-type-conversions.html
Oracle SQL  https://docs.oracle.com/cd/B19306_01/java.102/b14188/datamap.htm

 

 

반응형

'웹 개발 ( Web Development ) > 백엔드 ( Back-end )' 카테고리의 다른 글

[WEB] HTTP  (0) 2021.07.06
[WEB] URL & URI  (0) 2021.07.05
[WEB] MVC - Model ( VO, DTO, DAO )  (0) 2021.07.05
[WEB] MVC pattern  (0) 2021.05.12
[MyBatis] SQL insert 시 주 키 리턴하기  (0) 2021.05.11