跳到主要内容

附录:类型映射

根据 Java 类型获取对应的 JDBC Type

Java 类型JDBC 类型
java.lang.Boolean, booleanTypes.BIT
java.lang.Byte, byteTypes.TINYINT
java.lang.Short, short, java.time.Year, java.time.MonthTypes.SMALLINT
java.lang.Integer, intTypes.INTEGER
java.lang.Long, long, java.math.BigIntegerTypes.BIGINT
java.lang.Float, floatTypes.FLOAT
java.lang.Double, doubleTypes.DOUBLE
java.lang.Character, charTypes.CHAR
java.sql.Date, java.time.LocalDate, oracle.sql.DATETypes.DATE
java.sql.Time, java.time.LocalTimeTypes.TIME
java.util.Date, java.sql.Timestamp, java.time.Instant, java.time.LocalDateTime, java.time.chrono.JapaneseDate, oracle.sql.TIMESTAMPTypes.TIMESTAMP
java.time.OffsetDateTime, java.time.ZonedDateTime, oracle.sql.TIMESTAMPTZ, oracle.sql.TIMESTAMPLTZTypes.TIMESTAMP_WITH_TIMEZONE
java.time.OffsetTimeTypes.TIME_WITH_TIMEZONE
java.lang.String, java.time.YearMonthTypes.VARCHAR
java.math.BigDecimalTypes.DECIMAL
java.io.Reader, oracle.jdbc.OracleClobTypes.CLOB
java.io.InputStream, oracle.jdbc.OracleBlobTypes.BLOB
java.lang.Byte[], byte[]Types.VARBINARY
java.net.URLTypes.DATALINK
java.lang.Object[]Types.ARRAY
java.lang.ObjectTypes.JAVA_OBJECT
oracle.jdbc.OracleBlobTypes.BLOB
oracle.jdbc.OracleClobTypes.CLOB
oracle.jdbc.OracleNClobTypes.NCLOB
java.net.URL, java.net.URITypes.DATALINK