Mapping relationships between Sqlserver,mysql and Java types

Source: Internet
Author: User
Tags java se

The following are the corresponding relationships for SQL Server, JDBC type, and Java types:

S SQL Server Type ype

JDBC Type JDBC Type

Java Type Java Type

Mock Default Value

Description Description

bigint

BIGINT

Long

0

Timestamp

BINARY

Byte[]

Null

Use INSERT with a column list to exclude the timestamp column,

Or insert a DEFAULT into the timestamp column.

Binary

Bit

BIT

Boolean

False

Char

CHAR

String

X

Decimal

DECIMAL

Java.math.BigDecimal

Bigdecimal.zero (0)

Money

SmallMoney

Float

DOUBLE

Double

0.0

Int

INTEGER

Int

0

Image

LongVarBinary

Byte[]

Null

varbinary (max)

varchar (max)

LongVarChar

String

"Test"

Text

NChar

CHAR

String

0

NCHAR (Java SE 6.0)

nvarchar

VARCHAR

String

"TT"

NVARCHAR (Java SE 6.0)

nvarchar (max)

LongVarChar

String

"TT"

ntext

Numeric

NUMERIC

Java.math.BigDecimal

Bigdecimal.zero (0)

Real

REAL

Float

0.0

smallint

SMALLINT

Short

0

Datetime

TIMESTAMP

Java.sql.Timestamp

"2012-01-01 10:00:00"

smalldatetime

varbinary

VARBINARY

Byte[]

Null

varchar

VARCHAR

String

"TT"

tinyint

SMALLINT

Short

0

Guid

NVARCHAR

String

"TT"

Length limit

Xml

LongVarChar

String

"TT"

Time

Time

Java.sql.Time

"10:00:00"

Date

DATE

Java.sql.Date

"2012-01-01"

DateTime2

TIMESTAMP

Java.sql.Timestamp

"2012-01-01 10:00:00"

DateTimeOffset

Microsoft.sql.Types.

DATETIMEOFFSET

Microsoft.sql.DateTimeOffset

"2012-01-01 10:00:00"

Mapping relationships between Sqlserver,mysql and Java types

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.