数据库、JDBC、Java数据类型

人盡茶涼 提交于 2019-11-27 18:13:03

MS SQL SERVER 2012:

http://technet.microsoft.com/en-us/library/ms378599(v=sql.110).aspx

基本类型映射:

SQL Server Types

JDBC Types (java.sql.Types)

Java Language Types

bigint

BIGINT

long

binary

BINARY

byte[]

bit

BIT

boolean

char

CHAR

String

date

DATE

java.sql.Date

datetime

TIMESTAMP

java.sql.Timestamp

datetime2

TIMESTAMP

java.sql.Timestamp

datetimeoffset (2)

microsoft.sql.Types.DATETIMEOFFSET

microsoft.sql.DateTimeOffset

decimal

DECIMAL

java.math.BigDecimal

float

DOUBLE

double

image

LONGVARBINARY

byte[]

int

INTEGER

int

money

DECIMAL

java.math.BigDecimal

nchar

CHAR

NCHAR (Java SE 6.0)

String

ntext

LONGVARCHAR

LONGNVARCHAR (Java SE 6.0)

String

numeric

NUMERIC

java.math.BigDecimal

nvarchar

VARCHAR

NVARCHAR (Java SE 6.0)

String

nvarchar(max)

VARCHAR

NVARCHAR (Java SE 6.0)

String

real

REAL

float

smalldatetime

TIMESTAMP

java.sql.Timestamp

smallint

SMALLINT

short

smallmoney

DECIMAL

java.math.BigDecimal

text

LONGVARCHAR

String

time

TIME (1)

java.sql.Time (1)

timestamp

BINARY

byte[]

tinyint

TINYINT

short

udt

VARBINARY

byte[]

uniqueidentifier

CHAR

String

varbinary

VARBINARY

byte[]

varbinary(max)

VARBINARY

byte[]




varchar

VARCHAR

String

varchar(max)

VARCHAR

String

xml

LONGVARCHAR

LONGNVARCHAR (Java SE 6.0)

String

SQLXML

oracle10g

http://docs.oracle.com/cd/B19306_01/java.102/b14355/datacc.htm#g1069804

基本类型映射(默认的)

SQL Data Types JDBC Type Codes Standard Java Types Oracle Extension Java Types
 

STANDARD JDBC 1.0 TYPES:

   

CHAR

java.sql.Types.CHAR

java.lang.String

oracle.sql.CHAR

VARCHAR2

java.sql.Types.VARCHAR

java.lang.String

oracle.sql.CHAR

LONG

java.sql.Types.LONGVARCHAR

java.lang.String

oracle.sql.CHAR

NUMBER

java.sql.Types.NUMERIC

java.math.BigDecimal

oracle.sql.NUMBER

NUMBER

java.sql.Types.DECIMAL

java.math.BigDecimal

oracle.sql.NUMBER

NUMBER

java.sql.Types.BIT

boolean

oracle.sql.NUMBER

NUMBER

java.sql.Types.TINYINT

byte

oracle.sql.NUMBER

NUMBER

java.sql.Types.SMALLINT

short

oracle.sql.NUMBER

NUMBER

java.sql.Types.INTEGER

int

oracle.sql.NUMBER

NUMBER

java.sql.Types.BIGINT

long

oracle.sql.NUMBER

NUMBER

java.sql.Types.REAL

float

oracle.sql.NUMBER

NUMBER

java.sql.Types.FLOAT

double

oracle.sql.NUMBER

NUMBER

java.sql.Types.DOUBLE

double

oracle.sql.NUMBER

RAW

java.sql.Types.BINARY

byte[]

oracle.sql.RAW

RAW

java.sql.Types.VARBINARY

byte[]

oracle.sql.RAW

LONGRAW

java.sql.Types.LONGVARBINARY

byte[]

oracle.sql.RAW

DATE

java.sql.Types.DATE

java.sql.Date

oracle.sql.DATE

DATE

java.sql.Types.TIME

java.sql.Time

oracle.sql.DATE

TIMESTAMP

java.sql.Types.TIMESTAMP

javal.sql.Timestamp

oracle.sql.TIMESTAMP

 

STANDARD JDBC 2.0 TYPES:

   

BLOB

java.sql.Types.BLOB

java.sql.Blob

oracle.sql.BLOB

CLOB

java.sql.Types.CLOB

java.sql.Clob

oracle.sql.CLOB

user-defined object

java.sql.Types.STRUCT

java.sql.Struct

oracle.sql.STRUCT

user-defined reference

java.sql.Types.REF

java.sql.Ref

oracle.sql.REF

user-defined collection

java.sql.Types.ARRAY

java.sql.Array

oracle.sql.ARRAY

 

ORACLE EXTENSIONS:

   

BFILE

oracle.jdbc.OracleTypes.BFILE

NA

oracle.sql.BFILE

ROWID

oracle.jdbc.OracleTypes.ROWID

NA

oracle.sql.ROWID

REF CURSOR

oracle.jdbc.OracleTypes.CURSOR

java.sql.ResultSet

oracle.jdbc.OracleResultSet

TIMESTAMP

oracle.jdbc.OracleTypes.TIMESTAMP

java.sql.Timestamp

oracle.sql.TIMESTAMP

TIMESTAMP WITH TIME ZONE

oracle.jdbc.OracleTypes.TIMESTAMPTZ

java.sql.Timestamp

oracle.sql.TIMESTAMPTZ

TIMESTAMP WITH LOCAL TIME ZONE

oracle.jdbc.OracleTypes.TIMESTAMPLTZ

java.sql.Timestamp

oracle.sql.TIMESTAMPLTZ





易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!