When you are working with the Microsoft SQL Server 2005 JDBC Driver, there are two primary methods for establishing a connection to a SQL Server database. One is to set connection properties in the connection URL, and then call the getConnection method of the DriverManager class to return a SQLServerConnection object.

Note: For a list of the connection properties supported by the JDBC driver, see Setting the Connection Properties.

The second method involves setting the connection properties by using setter methods of the SQLServerDataSource class, and then calling the getConnection method to return a SQLServerConnection object.

The topics in this section describe the different ways in which you can connect to a SQL Server database, and they also demonstrate different techniques for retrieving data.

In This Section

Topic Description

Connection URL Sample

Describes how to use a connection URL to connect to SQL Server and then use an SQL statement to retrieve data.

Data Source Sample

Describes how to use a data source to connect to SQL Server and then use a stored procedure to retrieve data.

See Also