Working with data types (JDBC)

Download JDBC driver

The primary function of the Microsoft JDBC Driver for SQL Server is to allow Java developers to access data contained in SQL Server databases. To accomplish this, the JDBC driver mediates the conversion between SQL Server data types and Java language types and objects.

Note

For a detailed discussion of the SQL Server and JDBC driver data types, including their differences and how they are converted to Java language data types, see Understanding the JDBC driver data types.

In order to work with SQL Server data types, the JDBC driver provides get<Type> and set<Type> methods for the SQLServerPreparedStatement and SQLServerCallableStatement classes, and it provides get<Type> and update<Type> methods for the SQLServerResultSet class. Which method you use depends on the type of data that you are working with, and whether you are using result sets or queries.

The topics in this section describe how to use the JDBC driver data types to access SQL Server data in your Java applications.

In this section

Topic Description
Basic data types sample Describes how to use result set getter methods to retrieve basic SQL Server data type values, and how to use result set update methods to update those values.
SQLXML data type sample Describes how to store an XML data in a relational database, how to retrieve an XML data from a database, and how to parse an XML data with the SQLXML Java data type.
Spatial data types sample Describes how to store and retrieve data with Spatial Datatypes 'Geometry' and 'Geography' of SQL Server database with Geometry and Geography Java types defined by Microsoft JDBC Driver.

See also

Sample JDBC driver applications