Connecting and Retrieving Data
Collapse the table of content
Expand the table of content

Connecting and Retrieving Data

 

DownloadDownload JDBC Driver

When you are working with the Microsoft JDBC Driver for SQL Server, 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.

System_CAPS_ICON_note.jpg 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.

TopicDescription
Connection URL SampleDescribes how to use a connection URL to connect to SQL Server and then use an SQL statement to retrieve data.
Data Source SampleDescribes how to use a data source to connect to SQL Server and then use a stored procedure to retrieve data.

Sample JDBC Driver Applications

Community Additions

ADD
Show:
© 2016 Microsoft