Using Statements with SQL

When you work with data in a SQL Server database by using the Microsoft SQL Server JDBC Driver and inline SQL statements, there are different classes that you can use. Which class you use depends on the type of SQL statement that you want to run.

If your SQL statement contains no IN parameters, use the SQLServerStatement class, but if it does contain IN parameters, use the SQLServerPreparedStatement class.

Note

If you need to use SQL statements that contain both IN and OUT parameters, you must implement them as stored procedures and call them by using the SQLServerCallableStatement class. For more information about using stored procedures, see Using Statements with Stored Procedures.

The following sections describe the different scenarios for working with data in a SQL Server database by using SQL statements.

In This Section

Topic

Description

Using an SQL Statement with No Parameters

Describes how to use SQL statements that contain no parameters.

Using an SQL Statement with Parameters

Describes how to use SQL statements that contain parameters.

Using an SQL Statement to Modify Database Objects

Describes how to use SQL statements to modify database objects.

Using an SQL Statement to Modify Data

Describes how to use SQL statements to modify data in a database.

See Also

Other Resources

Using Statements with the JDBC Driver