--- title: "getConnection Method () | Microsoft Docs" ms.custom: "" ms.date: "01/19/2017" ms.prod: sql ms.prod_service: connectivity ms.reviewer: "" ms.technology: connectivity ms.topic: conceptual apiname: - "SQLServerDataSource.getConnection ()" apilocation: - "sqljdbc.jar" apitype: "Assembly" ms.assetid: 7f520e96-5313-468f-b987-535ddaea027e author: David-Engel ms.author: v-daenge --- # getConnection Method () [!INCLUDE[Driver_JDBC_Download](../../../includes/driver_jdbc_download.md)] Tries to establish a connection with the data source that this [SQLServerDataSource](../../../connect/jdbc/reference/sqlserverdatasource-class.md) object represents. ## Syntax ``` public java.sql.Connection getConnection() ``` ## Return Value A [SQLServerConnection](../../../connect/jdbc/reference/sqlserverconnection-class.md) object. ## Exceptions java.sql.SQLException ## Remarks This getConnection method is specified by the getConnection method in the javax.sql.DataSource interface. ## See Also [getConnection Method (SQLServerDataSource)](../../../connect/jdbc/reference/getconnection-method-sqlserverdatasource.md) [SQLServerDataSource Members](../../../connect/jdbc/reference/sqlserverdatasource-members.md) [SQLServerDataSource Class](../../../connect/jdbc/reference/sqlserverdatasource-class.md)