一个db里面的data type和java中的一个type的mapping分为两步:
1。db里面的data type map到jdbc的一个type
2。jdbc的一个type map到java的一个type
对于sql server,下面是sql server2000的data type和jdbc的data type的mapping:
SQL Server Data Type JDBC Data Type
bigint BIGINT
binary BINARY
bit BIT
char CHAR
datetime TIMESTAMP
decimal ECIMAL
float FLOAT
image LONGVARBINARY
int INTEGER
money DECIMAL
nchar CHAR
ntext LONGVARCHAR
numeric NUMERIC
nvarchar VARCHAR
real REAL
smalldatetime TIMESTAMP
smallint SMALLINT
smallmoney DECIMAL
sql_variant VARCHAR
sysname VARCHAR
text LONGVARCHAR
timestamp BINARY
tinyint TINYINT
uniqueidentifier CHAR
varbinary VARBINARY
varchar VARCHAR
下面是jdbc data type和java data type之间的mapping:
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
DATALINK java.net.URL
1。db里面的data type map到jdbc的一个type
2。jdbc的一个type map到java的一个type
对于sql server,下面是sql server2000的data type和jdbc的data type的mapping:
SQL Server Data Type JDBC Data Type
bigint BIGINT
binary BINARY
bit BIT
char CHAR
datetime TIMESTAMP
decimal ECIMAL
float FLOAT
image LONGVARBINARY
int INTEGER
money DECIMAL
nchar CHAR
ntext LONGVARCHAR
numeric NUMERIC
nvarchar VARCHAR
real REAL
smalldatetime TIMESTAMP
smallint SMALLINT
smallmoney DECIMAL
sql_variant VARCHAR
sysname VARCHAR
text LONGVARCHAR
timestamp BINARY
tinyint TINYINT
uniqueidentifier CHAR
varbinary VARBINARY
varchar VARCHAR
下面是jdbc data type和java data type之间的mapping:
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
DATALINK java.net.URL