Using statements with the JDBC driver
The Microsoft JDBC Driver for SQL Server can be used to work with data in a SQL Server database in a variety of ways. The JDBC driver can be used to run SQL statements against the database, or it can be used to call stored procedures in the database, using both input and output parameters. The JDBC driver also supports using SQL escape sequences, update counts, automatically generated keys, and performing updates within a batch operation.
The JDBC driver provides three classes for retrieving data from a SQL Server database:
SQLServerStatement - used for running SQL statements without parameters.
SQLServerPreparedStatement - (inherited from SQLServerStatement), used for running compiled SQL statements that might contain IN parameters.
SQLServerCallableStatement - (inherited from SQLServerPreparedStatement), used for running stored procedures that might contain IN parameters, OUT parameters, or both.
The topics in this section discuss how you can use each of the three statement classes to work with data in a SQL Server database.
In this section
Topic | Description |
---|---|
Using statements with SQL | Describes how to use SQL statements with the JDBC driver to work with data in a SQL Server database. |
Using statements with stored procedures | Describes how to use stored procedures with the JDBC driver to work with data in a SQL Server database. |
Using multiple result sets | Describes how to use the JDBC driver to retrieve data from multiple result sets. |
Using SQL escape sequences | Describes how to use SQL escape sequences, such as date and time literals and functions. |
Using auto generated keys | Describes how to use automatically generated keys. |
Performing batch operations | Describes how to use the JDBC driver to perform batch operations. |
Handling complex statements | Describes how to use the JDBC driver to run complex statements that perform a variety of tasks and might return different types of data. |