skip to main content
DataDirect Connect Drivers : Microsoft SQL Server Driver : Data Types
  
Data Types
The following table lists the data types supported by the SQL Server driver and how they are mapped to the JDBC data types.
Table 64. Microsoft SQL Server Data Types
Microsoft SQL Server Data Type
JDBC Data Type
bigint 1
BIGINT
bigint identity 2
BIGINT
binary
BINARY
bit
BIT
char
CHAR
date
DATE
datetime
TIMESTAMP
datetime2
TIMESTAMP
datetimeoffset
VARCHAR or TIMESTAMP 3
decimal
DECIMAL
decimal() identity
DECIMAL
float
FLOAT
image
LONGVARBINARY
int
INTEGER
int identity
INTEGER
money
DECIMAL
nchar
CHAR or NCHAR 4
ntext
LONGVARCHAR or LONGNVARCHAR 5
numeric
NUMERIC
numeric() identity
NUMERIC
nvarchar
VARCHAR or NVARCHAR 6
nvarchar(max) 7
LONGVARCHAR or LONGNVARCHAR8
real
REAL
smalldatetime
TIMESTAMP
smallint
SMALLINT
smallint identity
SMALLINT
smallmoney
DECIMAL
sql_variant 9
VARCHAR
sysname
VARCHAR
text
LONGVARCHAR
time
TIMESTAMP
timestamp
BINARY
tinyint
TINYINT
tinyint identity
TINYINT
uniqueidentifier
CHAR
varbinary
VARBINARY
varbinary(max) 10
LONGVARBINARY
varchar
VARCHAR
varchar(max) 11
LONGVARCHAR
xml 12, 13
LONGVARCHAR or SQLXML 14

1 Supported only for Microsoft SQL Server 2000 and higher.

2 Supported only for Microsoft SQL Server 2000 and higher.

3 When FetchTSWTZasTimestamp=false (default), this data type is mapped to the JDBC VARCHAR data type; when FetchTSWTZasTimestamp=true, it is mapped to the JDBC TIMESTAMP data type.

4 When JDBCBehavior=0, the data type depends on the JVM used by that application. For JVMs earlier than Java SE 6, the first value applies. For Java SE 6 and higher, the second value applies.

5 When JDBCBehavior=0, the data type depends on the JVM used by that application. For JVMs earlier than Java SE 6, the first value applies. For Java SE 6 and higher, the second value applies.

6 When JDBCBehavior=0, the data type depends on the JVM used by that application. For JVMs earlier than Java SE 6, the first value applies. For Java SE 6 and higher, the second value applies.

7 Supported only for Microsoft SQL Server 2005 and higher.

8 When JDBCBehavior=0, the data type depends on the JVM used by that application. For JVMs earlier than Java SE 6, the first value applies. For Java SE 6 and higher, the second value applies.

9 Supported only for Microsoft SQL Server 2000 and higher.

10 Supported only for Microsoft SQL Server 2005 and higher.

11 Supported only for Microsoft SQL Server 2005 and higher.

12 Supported only for Microsoft SQL Server 2005 and higher.

13 The XMLDescribeType property overrides the mappings for XML data.

14 When JDBCBehavior=0, the data type depends on the JVM used by that application. For JVMs earlier than Java SE 6, the first value applies. For Java SE 6 and higher, the second value applies.

Refer to "getTypeInfo()" in the DataDirect Connect Series for JDBC Reference for more information about data types.