mysql/sql server跟java之间的数据类型对应关系

  • 内容
  • 评论
  • 相关

mysql/sql server和java之间的数据类型对应关系

Mysql
************************************
当前列  ClassName     ColumnType  DisplaySize  TypeName
0:   java.lang.Integer  ColumnType:4  11  INTEGER
1:   java.lang.Integer  ColumnType:-6  4  TINYINT
2:   java.lang.String   ColumnType:12  0  UNKNOWN
3:   java.lang.Boolean  ColumnType:-7  1  TINYINT
4:   java.lang.Integer  ColumnType:5   6  SMALLINT
5:   java.lang.Integer  ColumnType:4   9  MEDIUMINT
6:   java.lang.Integer  ColumnType:4  11  INTEGER
7:   java.lang.Long    ColumnType:-5  20  BIGINT
8:   java.lang.Double   ColumnType:8  22  DOUBLE
9:   java.lang.Double   ColumnType:8  22  DOUBLE
10:  java.lang.Float   ColumnType:7  12  FLOAT
11:  java.lang.String   ColumnType:12  11  UNKNOWN
12:  java.lang.String   ColumnType:12  11  UNKNOWN
13:  java.lang.String   ColumnType:1  300  CHAR
14:  java.lang.String   ColumnType:12 300  VARCHAR
15:  java.sql.Date    ColumnType:91  10  DATE
16:  java.sql.Time    ColumnType:92  8  TIME
17:  java.sql.Date    ColumnType:91  4  YEAR
18:  java.sql.Timestamp  ColumnType:93  19  TIMESTAMP
19:  java.sql.Timestamp  ColumnType:93  19  DATETIME
20:  [B       ColumnType:-3 255   TINYBLOB
21:  [B       ColumnType:-4 65535   BLOB
22:  [B       ColumnType:-4 16777215  MEDIUMBLOB
23:  [B       ColumnType:-4 -1   BLOB
24:  java.lang.String  ColumnType:12  255  TINYBLOB
25:  java.lang.String  ColumnType:-1  65535  TEXT
26:  java.lang.String  ColumnType:-1  16777215  MEDIUMBLOB
27:  java.lang.String  ColumnType:-1  -1   TEXT
28:  java.lang.String  ColumnType:1   3   CHAR
29:  java.lang.String  ColumnType:1   3   CHAR

SQLServer
***********************************
0:  java.lang.Integer  ColumnType:4  11  int identity
1:  java.lang.Long    ColumnType:-5  20  bigint
2:  byte[]       ColumnType:-2  100  binary
3:  java.lang.Boolean  ColumnType:-7  1  bit
4:  java.lang.String   ColumnType:1  10  char
5:  java.sql.Timestamp  ColumnType:93  23  datetime
6:  java.sql.Timestamp  ColumnType:93  23  datetime
7:  java.math.BigDecimal ColumnType:3  20  decimal
8:  java.lang.Double   ColumnType:6  22  float
9:  byte[]       ColumnType:-4 2147483647  image
10:  java.math.BigDecimal ColumnType:3  21  money
11:  java.lang.String   ColumnType:1  10  nchar
12:  java.lang.String   ColumnType:-1 1073741823  ntext
13:  java.math.BigDecimal ColumnType:2  20  numeric
14:  java.lang.String   ColumnType:12  50  nvarchar
15:  java.lang.Float   ColumnType:7  13  real
16:  java.sql.Timestamp  ColumnType:93  16  smalldatetime
17:  java.lang.Integer  ColumnType:5   6  smallint
18:  java.math.BigDecimal ColumnType:3  12  smallmoney
19:  java.lang.String   ColumnType:12 8000  sql_variant
20:  java.lang.String   ColumnType:-1 2147483647  text
21:  byte[]       ColumnType:-2  16  timestamp
22:  java.lang.Integer  ColumnType:-6  3  tinyint
23:  java.lang.String   ColumnType:1  36  uniqueidentifier
24:  byte[]       ColumnType:-3 100  varbinary
25:  java.lang.String   ColumnType:12  50  varchar

 

 

 

==========================

原:http://apps.hi.baidu.com/share/detail/5475561

1 楼 zhushaolong 2011-02-15  
总结:
java.lang.Double==float
java.math.BigDecimal==decimal   money smallmoney numeric
java.sql.Timestamp==datetime smalldatetime
java.lang.Boolean==bit
java.lang.Float===real
byte[] ====binary image  timestamp varbinary
java.lang.String===varchar  uniqueidentifier text sql_variant nvarchar  ntext nchar char
java.lang.Integer==int  tinyint   smallint
java.lang.Long ===bigint
2 楼 zhushaolong 2011-02-15  
http://wenku.baidu.com/view/6d281600bed5b9f3f90f1c37.html
SQLServer类型与Java类型转换问题解决

原创文章,转载请注明: 转载自搞代码

本文链接地址: mysql/sql server跟java之间的数据类型对应关系

微信支付二维码

微信 赏一包辣条吧~

支付宝支付二维码

支付宝 赏一听可乐吧~

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注