Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 2.24 KB

File metadata and controls

43 lines (32 loc) · 2.24 KB
title Connecting with SQLDriverConnect
description SQLDriverConnect provides additional connection functionality over SQLConnect, including options to prompt the user for more information.
author David-Engel
ms.author davidengel
ms.date 08/20/2020
ms.service sql
ms.subservice connectivity
ms.topic concept-article
helpviewer_keywords
data sources [ODBC], connection functions
functions [ODBC], data source or driver connections
connecting to data source [ODBC], SQLDriverConnect
connecting to driver [ODBC], SQLDriverConnect
connecting to data source [ODBC], functions
connecting to driver [ODBC], functions
SQLDriverConnect function [ODBC], connecting
connection functions [ODBC]
ODBC drivers [ODBC], connection functions

Connecting with SQLDriverConnect

SQLDriverConnect is used to connect to a data source using a connection string. SQLDriverConnect is used instead of SQLConnect for the following scenarios:

  • Establish a connection using a connection string that contains the data source name, one or more user IDs, one or more passwords, and other information required by the data source.

  • Establish a connection using a partial connection string or no additional information; in this case, the Driver Manager and the driver can each prompt the user for connection information.

  • Establish a connection to a data source that is not defined in the system information. If the application supplies a partial connection string, the driver can prompt the user for connection information.

  • Establish a connection to a data source using a connection string constructed from the information in a .dsn file.

After a connection is established, SQLDriverConnect returns the completed connection string. The application can use this string for subsequent connection requests.

This section contains the following topics.