title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic |
---|---|---|---|---|---|---|---|
System Requirements, Installation, and Driver Files |
This article describes the system requirements for the Microsoft ODBC Driver for SQL Server. |
David-Engel |
v-davidengel |
08/08/2022 |
sql |
connectivity |
conceptual |
System requirements, installation, and driver files
[!INCLUDEDriver_ODBC_Download]
This article discusses the ODBC drivers that connect to SQL Server.
SQL version compatibility
Compatibility indicates that a driver was tested for compatibility against existing releases of SQL at the time of the driver’s release. SQL Server releases generally try to maintain backwards compatibility with existing client drivers. But new features in SQL Server releases may not be available with older client drivers.
Database version → ↓ Driver Version |
Azure SQL Database | Azure Synapse Analytics | Azure SQL Managed Instance | SQL Server 2019 | SQL Server 2017 | SQL Server 2016 | SQL Server 2014 | SQL Server 2012 | SQL Server 2008 R2 | SQL Server 2008 | SQL Server 2005 |
---|---|---|---|---|---|---|---|---|---|---|---|
18.1 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ||||
18.0 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.10 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.9 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.8 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.7 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.6 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.5 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.4 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.3 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
17.2 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ||
17.1 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ||
17.0 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ||
13.1 | Yes | Yes | Yes | Yes | Yes | Yes | |||||
13 | Yes | Yes | Yes | Yes | Yes | ||||||
11 | Yes | Yes | Yes | Yes | Yes |
Connection string details
The driver name that you specify in a connection string is one of the following:
ODBC Driver 11 for SQL Server
ODBC Driver 13 for SQL Server
(for both 13 and 13.1)ODBC Driver 17 for SQL Server
ODBC Driver 18 for SQL Server
Supported operating systems
The following matrix indicates driver version support for Windows operating system versions:
Operating system → ↓ Driver version |
Windows Server 2022 | Windows Server 2019 | Windows Server 2016 | Windows Server 2012 R2 | Windows Server 2012 | Windows Server 2008 R2 | Windows 11 | Windows 10 | Windows 8.1 | Windows 7 | Windows Vista SP2 |
---|---|---|---|---|---|---|---|---|---|---|---|
18.1 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
18.0 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.10 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.9 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.8 | Yes | Yes | Yes | Yes | Yes | Yes | |||||
17.7 | Yes | Yes | Yes | Yes | Yes | Yes | |||||
17.6 | Yes | Yes | Yes | Yes | Yes | Yes | |||||
17.5 | Yes | Yes | Yes | Yes | Yes | Yes | |||||
17.4 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.3 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |||
17.2 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ||||
17.1 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ||||
17.0 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ||||
13.1 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ||||
13 | Yes | Yes | Yes | Yes | |||||||
11 | Yes | Yes | Yes | Yes |
Installing Microsoft ODBC Driver for SQL Server
The driver is installed when you run msodbcsql.msi
from one of the Downloads for Windows.
[!NOTE]
For those who have Driver 17.1.0.1 or below installed, it is recommended that it be uninstalled manually prior to installing the newer version of the Driver.
Side-by-side with Native Client
The driver can be installed side-by-side with [!INCLUDEssNoVersion] Native Client. Major versions of the driver (11, 13, 17, 18) can all be installed side-by-side with each other, as well.
When you invoke msodbcsql.msi
, only the client components are installed by default. The client components are files that support running an application that was developed using the driver. To install the SDK components, specify ADDLOCAL=ALL
on the command line. Here is an example.
msiexec /i msodbcsql.msi ADDLOCAL=ALL
End-user license
Specify IACCEPTMSODBCSQLLICENSETERMS=YES
to accept the terms of the end-user license if you use the /passive
, /qn
, /qb
, or /qr
option to install. This option must be specified in all uppercase letters. Here is an example.
msiexec /quiet /passive /qn /i msodbcsql.msi IACCEPTMSODBCSQLLICENSETERMS=YES ADDLOCAL=ALL
Silent uninstall
The following example shows how to perform a silent uninstall.
msiexec /quiet /passive /qn /uninstall msodbcsql.msi
Indicate dependency
When an application uses the driver, the application should indicate that it depends on the driver through the install option APPGUID
. this indication enables the driver installer to report dependent applications before uninstalling. To specify a dependency on the driver, set the APPGUID
command-line parameter to your product code when silently installing the driver. A product code must be created when using Microsoft Installer to bundle your application setup program. Here is an example.
msiexec /i msodbcsql.msi APPGUID={ <Your dependent application's APPGUID> }
Command-line tools: sqlcmd.exe and bcp.exe
The bcp.exe
and sqlcmd.exe
tools for use with the driver can be downloaded at Microsoft Command Line Utilities 11 for SQL Server, Microsoft Command Line Utilities 13 for SQL Server, or Microsoft Command Line Utilities 13.1 for SQL Server. The driver is a prerequisite to install sqlcmd.exe
and bcp.exe
.
bcp.exe
and sqlcmd.exe
are installed in the 110Tools
subfolder of %PROGRAMFILES%Microsoft SQL ServerClient SDKODBC
for version 11, and 130Tools
for 13 and 13.1.
An application that uses BCP functions must specify the driver from the same version which shipped with the header file and library used to compile the application.
For example, when you compile an ODBC application with msodbcsql11.lib
and msodbcsql.h
, use «DRIVER={ODBC Driver 11 for SQL Server}» in the connection string.
Components of the Microsoft ODBC Driver for [!INCLUDEssNoVersion] on Windows
The ODBC driver on Windows contains the following components:
Component | Description |
---|---|
msodbcsql18.dll or msodbcsql17.dll or msodbcsql13.dll or msodbcsql11.dll |
The dynamic-link library (DLL) file that contains all of the driver’s functionality. This file is installed in %SYSTEMROOT%System32. |
msodbcdiag18.dll or msodbcdiag17.dll or msodbcdiag13.dll or msodbcdiag11.dll |
The dynamic-link library (DLL) file that contains the driver’s diagnostics (tracing) interface. This file is installed in %SYSTEMROOT%System32. |
msodbcsqlr18.rll or msodbcsqlr17.rll or msodbcsqlr13.rll or msodbcsqlr11.rll |
The accompanying resource file for the driver library. This file is installed in %SYSTEMROOT%System321033. |
s13ch_msodbcsql.chm or s11ch_msodbcsql.chm |
The Data Source Wizard help file that documents how to create a data source for the driver. This file is installed in %SYSTEMROOT%System321033
NOTE: There is no chm file for ODBC Driver 17 and above. |
msodbcsql.h | The header file that contains all of the new definitions needed to use the driver.
Note: You cannot reference msodbcsql.h and odbcss.h in the same program. msodbcsql.h for ODBC Driver 18 is installed in %PROGRAMFILES%Microsoft SQL ServerClient SDKODBC180SDK. |
msodbcsql18.lib or msodbcsql17.lib or msodbcsql13.lib or msodbcsql11.lib |
The library file needed to call the bcp utility functions that are part of the driver.
Note: If you do reference this library file in your program, make sure that it is in your system path and in the system path of those that use the application. msodbcsql18.lib is installed in %PROGRAMFILES%Microsoft SQL ServerClient SDKODBC180SDK. |
See also
Microsoft ODBC Driver for SQL Server on Windows
After 12 years on SqlServerBuilds.blogspot.com, it has been moved here to www.SqlServerVersions.com. The old address will be redirected automatically.
After SQL Server 2012, the primary ODBC driver for SQL Server has been developed and released as the Microsoft ODBC Driver for SQL Server. The Microsoft ODBC Driver for SQL Server is the driver that is updated with the most recent server features going forward.
How do I know what version/build I have? Look in the C:WindowsSystem32
or C:WindowsSysWOW64
folder for the file:
msodbcsql18.dll, or
msodbcsql17.dll, or
msodbcsql13.dll, or
msodbcsql11.dll
In the file properties, the Details
tab and the Product version
field.
Microsoft ODBC Driver for SQL Server build numbers:
Build | File version | Description | Release date |
---|---|---|---|
18.1.2.1 | 2018.181.2.1 | Microsoft ODBC Driver 18.1.2 for SQL Server Windows Latest Download x64 Installer
Download x86 Installer |
2022-11-03 *new |
18.1.1.1 | 2018.181.1.1 | Microsoft ODBC Driver 18.1.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2022-08-08 |
18.0.1.1 | 2018.180.1.1 | Microsoft ODBC Driver 18.0.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2022-02-15 |
17.10.3.1 | 2017.1710.3.1 | Microsoft ODBC Driver 17.10.3 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2023-01-26 *new |
17.10.2.1 | 2017.1710.2.1 | Microsoft ODBC Driver 17.10.2 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2022-11-28 *new |
17.10.1.1 | 2017.1710.1.1 | Microsoft ODBC Driver 17.10.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2022-06-30 |
17.9.1.1 | 2017.179.1.1 | Microsoft ODBC Driver 17.9.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2022-02-17 |
17.8.1.1 | 2017.178.1.1 | Microsoft ODBC Driver 17.8.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2021-07-30 |
17.7.2.1 | 2017.177.2.1 | Microsoft ODBC Driver 17.7.2 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2021-03-10 |
17.7.1.1 | 2017.177.1.1 | Microsoft ODBC Driver 17.7.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2021-01-29 |
17.6.1.1 | 2017.176.1.1 | Microsoft ODBC Driver 17.6.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2020-07-31 |
17.5.2.1 | 2017.175.2.1 | Microsoft ODBC Driver 17.5.2 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2020-03-06 |
17.5.1.1 | 2017.175.1.1 | Microsoft ODBC Driver 17.5.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2020-01-31 |
17.4.2.1 | 2017.174.2.1 | Microsoft ODBC Driver 17.4.2 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2019-10-04 |
17.4.1.1 | 2017.174.1.1 | Microsoft ODBC Driver 17.4.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2019-07-24 |
17.3.1.1 | 2017.173.1.1 | Microsoft ODBC Driver 17.3.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2019-02-14 |
17.3.0.1 | 2017.173.0.1 | Microsoft ODBC Driver 17.3.0 for SQL Server (Preview) Windows Preview Download x64 Installer
Download x86 Installer |
2018-09-21 |
17.2.0.1 | 2017.172.0.1 | Microsoft ODBC Driver 17.2.0 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2018-06-23 |
17.1.0.1 | 2017.171.0.1 | Microsoft ODBC Driver 17.1.0 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2018-03-27 |
17.0.1.1 | 2017.170.1.1 | Microsoft ODBC Driver 17.0.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2018-01-19 |
13.0.4414.46 | 2015.131.4414.46 | Microsoft ODBC Driver 13.1 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2018-03-13 |
13.0.811.168 | 2015.130.811.168 | Microsoft ODBC Driver 13 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2016-07-20 |
12.0.5543.11 | 2014.120.5543.11 | Microsoft ODBC Driver 11 for SQL Server Windows Download x64 Installer
Download x86 Installer |
2017-03-02 |
You can comment here. If you know of a Microsoft ODBC Driver for SQL Server version that we don’t have listed here, please use the comments.
I work on this site continuously and keep the information up to date. If it helps you, you can support me:
Buy me a coffee
Support me in another way
© 2007–2023 SqlServerVersions.com · Contact · Disclaimer · Privacy policy

This article will serve as an informative guide and give you a clear understanding of how to perform silent or interactive installs and uninstalls of Microsoft ODBC Driver 17 for SQL Server using the Powershell App Deployment Toolkit. The PowerShell App Deployment Toolkit can be used to replace your WiseScript, VBScript and Batch wrapper scripts with one versatile, re-usable and extensible tool. This tool is an absolute must for Microsoft Endpoint Manager Configuration Manager (MEMCM) / (SCCM) Administrators or anyone who is responsible for packaging and deploying software.
- Download the Powershell App Deployment Toolkit 3.8.4:
- https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/releases/download/3.8.4/PSAppDeployToolkit_v3.8.4.zip
- Download the zip file to a folder created at (C:Downloads)
- Open Windows PowerShell by Right-Clicking on Windows PowerShell and selecting Run as Administrator
- Enter the following command to remove the Zone.Identifier:
Unblock-File -Path C:DownloadsPSAppDeployToolkit_v3.8.4.zip
- Enter the following command to extract the contents of the zip file:
Expand-Archive -Path C:DownloadsPSAppDeployToolkit_v3.8.4.zip -DestinationPath C:DownloadsPADT
- Enter the following commands to copy the AppDeployToolkit & Files folders to “C:DownloadsMSODBCSQL17”:
Copy-Item -Path "C:DownloadsPADTToolkitAppDeployToolkit" -Destination "C:DownloadsMSODBCSQL17AppDeployToolkit" -Recurse
Copy-Item -Path "C:DownloadsPADTToolkitFiles" -Destination "C:DownloadsMSODBCSQL17Files"
- We also need to create two additional directories called x86 & x64
New-Item "C:Downloads
Filesx86" -ItemType DirectoryMSODBCSQL17
New-Item "C:Downloads
Filesx64" -ItemType DirectoryMSODBCSQL17
You should now see the AppDeploymentToolkit folder with files & the Files directory with empty x86 & x64 folders at “C:DownloadsMSODBCSQL17“
I like to keep my scripts as dynamic as possible so they can handle multiple scenarios such as the ability to install the 32-bit version of Microsoft ODBC Driver 17 for SQL Server on 32-bit systems and the 64-bit version of Microsoft ODBC Driver 17 for SQL Server on 64-bit systems. Next we’ll want to download both the 32-bit & 64-bit MSI installers for Microsoft ODBC Driver 17 for SQL Server & the Visual C++ prerequisites.
- Navigate to: https://docs.microsoft.com/en-us/sql/connect/odbc/windows/release-notes-odbc-sql-server-windows?view=sql-server-ver15#179
- Select Download x86 installer link
- Download & Copy the msodbcsql.msi to “C:DownloadsMSODBCSQL17Filesx86”
- Navigate to: https://aka.ms/vs/17/release/vc_redist.x86.exe
- Download & Copy the vc_redist.x86.exe to “C:DownloadsMSODBCSQL17Filesx86”
- Navigate to: https://docs.microsoft.com/en-us/sql/connect/odbc/windows/release-notes-odbc-sql-server-windows?view=sql-server-ver15#179
- Select Download x64 installer link
- Download & Copy the msodbcsql.msi to “C:DownloadsMSODBCSQL17Filesx64”
- Navigate to: https://aka.ms/vs/17/release/vc_redist.x64.exe
- Download & Copy the vc_redist.x64.exe to “C:DownloadsMSODBCSQL17Filesx64”
- Copy the PowerShell script below to “C:DownloadsMSODBCSQL17“ & name it Deploy-MSODBCSQL17.ps1
<# .SYNOPSIS This script performs the installation or uninstallation of Microsoft ODBC Driver 17 for SQL Server. # LICENSE # PowerShell App Deployment Toolkit - Provides a set of functions to perform common application deployment tasks on Windows. Copyright (C) 2017 - Sean Lillis, Dan Cunningham, Muhammad Mashwani, Aman Motazedian. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. .DESCRIPTION The script is provided as a template to perform an install or uninstall of an application(s). The script either performs an "Install" deployment type or an "Uninstall" deployment type. The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install. The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application. .PARAMETER DeploymentType The type of deployment to perform. Default is: Install. .PARAMETER DeployMode Specifies whether the installation should be run in Interactive, Silent, or NonInteractive mode. Default is: Interactive. Options: Interactive = Shows dialogs, Silent = No dialogs, NonInteractive = Very silent, i.e. no blocking apps. NonInteractive mode is automatically set if it is detected that the process is not user interactive. .PARAMETER AllowRebootPassThru Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. If 3010 is passed back to SCCM, a reboot prompt will be triggered. .PARAMETER TerminalServerMode Changes to "user install mode" and back to "user execute mode" for installing/uninstalling applications for Remote Destkop Session Hosts/Citrix servers. .PARAMETER DisableLogging Disables logging to file for the script. Default is: $false. .EXAMPLE PowerShell.exe .Deploy-MSODBCSQL17.ps1 -DeploymentType "Install" -DeployMode "NonInteractive" .EXAMPLE PowerShell.exe .Deploy-MSODBCSQL17.ps1 -DeploymentType "Install" -DeployMode "Silent" .EXAMPLE PowerShell.exe .Deploy-MSODBCSQL17.ps1 -DeploymentType "Install" -DeployMode "Interactive" .EXAMPLE PowerShell.exe .Deploy-MSODBCSQL17.ps1 -DeploymentType "Uninstall" -DeployMode "NonInteractive" .EXAMPLE PowerShell.exe .Deploy-MSODBCSQL17.ps1 -DeploymentType "Uninstall" -DeployMode "Silent" .EXAMPLE PowerShell.exe .Deploy-MSODBCSQL17.ps1 -DeploymentType "Uninstall" -DeployMode "Interactive" .NOTES Toolkit Exit Code Ranges: 60000 - 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1 69000 - 69999: Recommended for user customized exit codes in Deploy-Application.ps1 70000 - 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1 .LINK http://psappdeploytoolkit.com #> [CmdletBinding()] Param ( [Parameter(Mandatory=$false)] [ValidateSet('Install','Uninstall','Repair')] [string]$DeploymentType = 'Install', [Parameter(Mandatory=$false)] [ValidateSet('Interactive','Silent','NonInteractive')] [string]$DeployMode = 'Interactive', [Parameter(Mandatory=$false)] [switch]$AllowRebootPassThru = $false, [Parameter(Mandatory=$false)] [switch]$TerminalServerMode = $false, [Parameter(Mandatory=$false)] [switch]$DisableLogging = $false ) Try { ## Set the script execution policy for this process Try { Set-ExecutionPolicy -ExecutionPolicy 'ByPass' -Scope 'Process' -Force -ErrorAction 'Stop' } Catch {} ##*=============================================== ##* VARIABLE DECLARATION ##*=============================================== ## Variables: Application [string]$appVendor = '' [string]$appName = 'Microsoft ODBC Driver 17 for SQL Server' [string]$appVersion = '' [string]$appArch = '' [string]$appLang = '' [string]$appRevision = '' [string]$appScriptVersion = '1.0.0' [string]$appScriptDate = 'XX/XX/20XX' [string]$appScriptAuthor = 'Jason Bergner' ##*=============================================== ## Variables: Install Titles (Only set here to override defaults set by the toolkit) [string]$installName = '' [string]$installTitle = 'Microsoft ODBC Driver 17 for SQL Server' ##* Do not modify section below #region DoNotModify ## Variables: Exit Code [int32]$mainExitCode = 0 ## Variables: Script [string]$deployAppScriptFriendlyName = 'Deploy Application' [version]$deployAppScriptVersion = [version]'3.8.4' [string]$deployAppScriptDate = '26/01/2021' [hashtable]$deployAppScriptParameters = $psBoundParameters ## Variables: Environment If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation } [string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent ## Dot source the required App Deploy Toolkit Functions Try { [string]$moduleAppDeployToolkitMain = "$scriptDirectoryAppDeployToolkitAppDeployToolkitMain.ps1" If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType 'Leaf')) { Throw "Module does not exist at the specified location [$moduleAppDeployToolkitMain]." } If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain } } Catch { If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 } Write-Error -Message "Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message)`n `n$($_.InvocationInfo.PositionMessage)" -ErrorAction 'Continue' ## Exit the script, returning the exit code to SCCM If (Test-Path -LiteralPath 'variable:HostInvocation') { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode } } #endregion ##* Do not modify section above ##*=============================================== ##* END VARIABLE DECLARATION ##*=============================================== If ($deploymentType -ine 'Uninstall' -and $deploymentType -ine 'Repair') { ##*=============================================== ##* PRE-INSTALLATION ##*=============================================== [string]$installPhase = 'Pre-Installation' ## Show Welcome Message Show-InstallationWelcome ## Show Progress Message (with the default message) Show-InstallationProgress ## Remove Any Existing Version of Microsoft ODBC Driver 17 for SQL Server Remove-MSIApplications -Name "Microsoft ODBC Driver 17 for SQL Server" ##*=============================================== ##* INSTALLATION ##*=============================================== [string]$installPhase = 'Installation' If ($ENV:PROCESSOR_ARCHITECTURE -eq 'x86'){ Write-Log -Message "Detected 32-bit OS Architecture." -Severity 1 -Source $deployAppScriptFriendlyName ## Install Microsoft Visual C++ 2017 Redistributable (x86) $VC201732 = Get-ChildItem -Path "$dirFilesx86" -Include vc_redist.x86.exe -File -Recurse -ErrorAction SilentlyContinue If($VC201732.Exists) { Write-Log -Message "Found $($VC201732.FullName), now attempting to install Microsoft Visual C++ 2017 Redistributable (x86)." Show-InstallationProgress "Installing Microsoft Visual C++ 2017 Redistributable (x86). This may take some time. Please wait..." Execute-Process -Path "$VC201732" -Parameters "/install /quiet /norestart /log C:WindowsLogsSoftwareVisualC++2017x86-Install.log" -WindowStyle Hidden -IgnoreExitCodes "1638" } ## Install Microsoft ODBC Driver 17 for SQL Server on 32-bit System $MsiPath32 = Get-ChildItem -Path "$dirFilesx86" -Include msodbcsql.msi -File -Recurse -ErrorAction SilentlyContinue If($MsiPath32.Exists) { Write-Log -Message "Found $($MsiPath32.FullName), now attempting to install $installTitle (32-bit)." Show-InstallationProgress "Installing the Microsoft ODBC Driver 17 for SQL Server on 32-bit System. This may take some time. Please wait..." Execute-MSI -Action Install -Path "$MsiPath32" -AddParameters "IACCEPTMSODBCSQLLICENSETERMS=YES" } } Else { Write-Log -Message "Detected 64-bit OS Architecture" -Severity 1 -Source $deployAppScriptFriendlyName ## Install Microsoft Visual C++ 2017 Redistributable (x64) $VC201764 = Get-ChildItem -Path "$dirFilesx64" -Include vc_redist.x64.exe -File -Recurse -ErrorAction SilentlyContinue If($VC201764.Exists) { Write-Log -Message "Found $($VC201764.FullName), now attempting to install Microsoft Visual C++ 2017 Redistributable (x64)." Show-InstallationProgress "Installing Microsoft Visual C++ 2017 Redistributable (x64). This may take some time. Please wait..." Execute-Process -Path "$VC201764" -Parameters "/install /quiet /norestart /log C:WindowsLogsSoftwareVisualC++2017x64-Install.log" -WindowStyle Hidden -IgnoreExitCodes "1638" } ## Install Microsoft ODBC Driver 17 for SQL Server on 64-bit System $MsiPath64 = Get-ChildItem -Path "$dirFilesx64" -Include msodbcsql.msi -File -Recurse -ErrorAction SilentlyContinue If($MsiPath64.Exists) { Write-Log -Message "Found $($MsiPath64.FullName), now attempting to install $installTitle (64-bit)." Show-InstallationProgress "Installing the Microsoft ODBC Driver 17 for SQL Server on 64-bit System. This may take some time. Please wait..." Execute-MSI -Action Install -Path "$MsiPath64" -AddParameters "IACCEPTMSODBCSQLLICENSETERMS=YES" } } ##*=============================================== ##* POST-INSTALLATION ##*=============================================== [string]$installPhase = 'Post-Installation' } ElseIf ($deploymentType -ieq 'Uninstall') { ##*=============================================== ##* PRE-UNINSTALLATION ##*=============================================== [string]$installPhase = 'Pre-Uninstallation' ## Show Welcome Message Show-InstallationWelcome ## Show Progress Message (With a Message to Indicate the Application is Being Uninstalled) Show-InstallationProgress -StatusMessage "Uninstalling the $installTitle. Please Wait..." ##*=============================================== ##* UNINSTALLATION ##*=============================================== [string]$installPhase = 'Uninstallation' ## Remove Any Existing Version of Microsoft ODBC Driver 17 for SQL Server Remove-MSIApplications -Name "Microsoft ODBC Driver 17 for SQL Server" ##*=============================================== ##* POST-UNINSTALLATION ##*=============================================== [string]$installPhase = 'Post-Uninstallation' } ElseIf ($deploymentType -ieq 'Repair') { ##*=============================================== ##* PRE-REPAIR ##*=============================================== [string]$installPhase = 'Pre-Repair' ##*=============================================== ##* REPAIR ##*=============================================== [string]$installPhase = 'Repair' ##*=============================================== ##* POST-REPAIR ##*=============================================== [string]$installPhase = 'Post-Repair' } ##*=============================================== ##* END SCRIPT BODY ##*=============================================== ## Call the Exit-Script function to perform final cleanup operations Exit-Script -ExitCode $mainExitCode } Catch { [int32]$mainExitCode = 60001 [string]$mainErrorMessage = "$(Resolve-Error)" Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName Show-DialogBox -Text $mainErrorMessage -Icon 'Stop' Exit-Script -ExitCode $mainExitCode }
Ok, all the hard work is done and now you can install or uninstall Microsoft ODBC Driver 17 for SQL Server using one single PowerShell script. Simply change the DeploymentType parameter to install or uninstall. Logging functionality is built-in automatically and you can view the log files under “C:WindowsLogsSoftware”.
Microsoft ODBC Driver 17 for SQL Server NonInteractive Install (PowerShell)
NonInteractive means Very Silent, i.e. no blocking apps. This is automatically set if it is detected that the process is not running in the user session and it is not possible for anyone to provide input using a mouse or keyboard.
- Open Windows PowerShell by Right-Clicking on Windows PowerShell and selecting Run as Administrator
- Change the directory to “C:DownloadsMSODBCSQL17”
- PS C:DownloadsMSODBCSQL17>
- Enter the following command:
Powershell.exe -ExecutionPolicy Bypass .Deploy-MSODBCSQL17.ps1 -DeploymentType "Install" -DeployMode "NonInteractive"
Microsoft ODBC Driver 17 for SQL Server Silent Install (PowerShell)
Silent means no dialogs (progress and balloon tip notifications are suppressed).
- Open Windows PowerShell by Right-Clicking on Windows PowerShell and selecting Run as Administrator
- Change the directory to “C:DownloadsMSODBCSQL17“
- PS C:DownloadsMSODBCSQL17>
- Enter the following command:
Powershell.exe -ExecutionPolicy Bypass .Deploy-MSODBCSQL17.ps1 -DeploymentType "Install" -DeployMode "Silent"
Microsoft ODBC Driver 17 for SQL Server Interactive Install (PowerShell)
Interactive means the install will show dialogs including progress and balloon tip notifications.
- Open Windows PowerShell by Right-Clicking on Windows PowerShell and selecting Run as Administrator
- Change the directory to “C:DownloadsMSODBCSQL17”
- PS C:DownloadsMSODBCSQL17>
- Enter the following command:
Powershell.exe -ExecutionPolicy Bypass .Deploy-MSODBCSQL17.ps1 -DeploymentType "Install" -DeployMode "Interactive"
Microsoft ODBC Driver 17 for SQL Server NonInteractive Uninstall (PowerShell)
NonInteractive means Very Silent, i.e. no blocking apps. This is automatically set if it is detected that the process is not running in the user session and it is not possible for anyone to provide input using a mouse or keyboard.
- Open Windows PowerShell by Right-Clicking on Windows PowerShell and selecting Run as Administrator
- Change the directory to “C:DownloadsMSODBCSQL17“
- PS C:DownloadsMSODBCSQL17>
- Enter the following command:
Powershell.exe -ExecutionPolicy Bypass .Deploy-MSODBCSQL17.ps1 -DeploymentType "Uninstall" -DeployMode "NonInteractive"
Microsoft ODBC Driver 17 for SQL Server Silent Uninstall (PowerShell)
Silent means no dialogs (progress and balloon tip notifications are suppressed).
- Open Windows PowerShell by Right-Clicking on Windows PowerShell and selecting Run as Administrator
- Change the directory to “C:DownloadsMSODBCSQL17“
- PS C:DownloadsMSODBCSQL17>
- Enter the following command:
Powershell.exe -ExecutionPolicy Bypass .Deploy-MSODBCSQL17.ps1 -DeploymentType "Uninstall" -DeployMode "Silent"
Microsoft ODBC Driver 17 for SQL Server Interactive Uninstall (PowerShell)
Interactive means the install will show dialogs including progress and balloon tip notifications.
- Open Windows PowerShell by Right-Clicking on Windows PowerShell and selecting Run as Administrator
- Change the directory to “C:DownloadsMSODBCSQL17“
- PS C:DownloadsMSODBCSQL17>
- Enter the following command:
Powershell.exe -ExecutionPolicy Bypass .Deploy-MSODBCSQL17.ps1 -DeploymentType "Uninstall" -DeployMode "Interactive"
Always make sure to test everything in a development environment prior to implementing anything into production. The information in this article is provided “As Is” without warranty of any kind.
Devart ODBC Driver for SQL Server provides a high-performance and feature-rich connectivity solution for ODBC-compliant applications to access SQL Server databases from Windows, macOS, and Linux, both 32-bit and 64-bit. Apple Silicon M1 is supported. Full support for standard ODBC API functions and data types implemented in our driver makes interaction of your application with SQL Server fast, easy and extremely handy.
Available in both installer formats, MSI and EXE.
Key Features
Direct Connection
Our connectivity solution enables various ODBC-aware applications to establish a direct connection to SQL Server via TCP/IP to eliminate the need for SQL Server Сlient. Direct connection increases the speed of data transmission between an external application and SQL Server, which is crucial for data analysis in real time. It also streamlines the deployment process, since there is no need to distribute any additional client software with the driver.
Cost-Effective Deployment
Our ODBC driver is a standalone installation file that doesn’t require the user to deploy and configure any additional software such as a database client or a vendor library. Deployment costs are reduced drastically, especially when using the silent install method with an OEM license in large organizations that have hundreds of machines.
Secure Connection
Work with SQL Server securely using SSL connection options provided in our driver along with the support for SSL protocol. You can also connect to SQL Server securely via SSH tunnel. SSH protocol is one of the most reliable protocols for data encryption.
Advanced Data Conversion
We have implemented advanced Data Conversion mechanisms that provide bi-directional mapping between any SQL Server and ODBC data types.
ODBC Conformance
The driver provides full support for common ODBC interface:
- ODBC API Functions support
- ODBC Data Types support
Additionally, we support Advanced Connection String parameters to allow desktop or web applications to connect to SQL Server from various environments and platforms that support ODBC.
Bulk Updates
Moreover, with our driver you can perform bulk updates to SQL Server database by combining SQL statements into batches, thus simplifying and speeding up large data modification to SQL Server.
SQL Server Compatibility
Our driver is compatible with major and the latest SQL Server versions.
- SQL Server 2019, 2017, 2016, 2014, 2012, 2008 R2, 2008, 2005 (including Express edition)
- SQL Server 2000 (including MSDE)
- SQL Server Compact 4.0, 3.5, 3.1
Integration
The driver is compatible with 3rd-party tools for data analysis, such as Microsoft Excel, and integrates with various IDEs and systems like Visual Studio, etc.
For the complete list of compatible tools and environments visit the Compatibility page.
Platforms Variety
ODBC Driver for SQL Server can be used with 32-bit and 64-bit applications on both x32 and x64 platforms, so there is no need to additionally configure the driver, applications or environment.
Fully Unicode-Compliant Driver
With our fully Unicode-compliant driver, you can properly retrieve and modify any data in multilingual SQL Server databases, regardless of their character set: Latin, Cyrillic, Hebrew, Chinese, etc., and in any language environment.
SQL Server 2019
Standard security
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;UID=myUsername;PWD=myPassword;
Trusted Connection
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;
Connecting to an SQL Server instance
The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.
Driver={ODBC Driver 17 for SQL Server};Server=serverNameinstanceName;Database=myDataBase;Trusted_Connection=yes;
Using a non-standard port
If your SQL Server listens on a non-default port you can specify that using the servername,xxxx syntax (note the comma, it’s not a colon).
Driver={ODBC Driver 17 for SQL Server};Server=myServerName,myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;
Enable MARS
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;MARS_Connection=yes;
Encrypt data sent over network
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;Encrypt=yes;
Attach a database file on connect to a local SQL Server Express instance
Driver={ODBC Driver 17 for SQL Server};Server=.SQLExpress;AttachDBFileName=c:dir\mydb.mdf;Database=dbName;Trusted_Connection=yes;
Database mirroring
If you connect to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Failover_Partner=myMirrorServerAddress;Database=myDataBase;Trusted_Connection=yes;
SQL Server 2017
Standard security
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;UID=myUsername;PWD=myPassword;
Trusted Connection
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;
Connecting to an SQL Server instance
The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.
Driver={ODBC Driver 17 for SQL Server};Server=serverNameinstanceName;Database=myDataBase;Trusted_Connection=yes;
Using a non-standard port
If your SQL Server listens on a non-default port you can specify that using the servername,xxxx syntax (note the comma, it’s not a colon).
Driver={ODBC Driver 17 for SQL Server};Server=myServerName,myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;
Enable MARS
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;MARS_Connection=yes;
Encrypt data sent over network
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;Encrypt=yes;
Attach a database file on connect to a local SQL Server Express instance
Driver={ODBC Driver 17 for SQL Server};Server=.SQLExpress;AttachDBFileName=c:dir\mydb.mdf;Database=dbName;Trusted_Connection=yes;
Database mirroring
If you connect to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Failover_Partner=myMirrorServerAddress;Database=myDataBase;Trusted_Connection=yes;
SQL Server 2016
Standard security
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;UID=myUsername;PWD=myPassword;
Trusted Connection
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;
Connecting to an SQL Server instance
The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.
Driver={ODBC Driver 17 for SQL Server};Server=serverNameinstanceName;Database=myDataBase;Trusted_Connection=yes;
Using a non-standard port
If your SQL Server listens on a non-default port you can specify that using the servername,xxxx syntax (note the comma, it’s not a colon).
Driver={ODBC Driver 17 for SQL Server};Server=myServerName,myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;
Enable MARS
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;MARS_Connection=yes;
Encrypt data sent over network
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;Encrypt=yes;
Attach a database file on connect to a local SQL Server Express instance
Driver={ODBC Driver 17 for SQL Server};Server=.SQLExpress;AttachDBFileName=c:dir\mydb.mdf;Database=dbName;Trusted_Connection=yes;
Database mirroring
If you connect to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Failover_Partner=myMirrorServerAddress;Database=myDataBase;Trusted_Connection=yes;
SQL Server 2014
Standard security
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;UID=myUsername;PWD=myPassword;
Trusted Connection
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;
Connecting to an SQL Server instance
The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.
Driver={ODBC Driver 17 for SQL Server};Server=serverNameinstanceName;Database=myDataBase;Trusted_Connection=yes;
Using a non-standard port
If your SQL Server listens on a non-default port you can specify that using the servername,xxxx syntax (note the comma, it’s not a colon).
Driver={ODBC Driver 17 for SQL Server};Server=myServerName,myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;
Enable MARS
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;MARS_Connection=yes;
Encrypt data sent over network
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;Encrypt=yes;
Attach a database file on connect to a local SQL Server Express instance
Driver={ODBC Driver 17 for SQL Server};Server=.SQLExpress;AttachDBFileName=c:dir\mydb.mdf;Database=dbName;Trusted_Connection=yes;
Database mirroring
If you connect to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Failover_Partner=myMirrorServerAddress;Database=myDataBase;Trusted_Connection=yes;
SQL Server 2012
Standard security
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;UID=myUsername;PWD=myPassword;
Trusted Connection
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;
Connecting to an SQL Server instance
The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.
Driver={ODBC Driver 17 for SQL Server};Server=serverNameinstanceName;Database=myDataBase;Trusted_Connection=yes;
Using a non-standard port
If your SQL Server listens on a non-default port you can specify that using the servername,xxxx syntax (note the comma, it’s not a colon).
Driver={ODBC Driver 17 for SQL Server};Server=myServerName,myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;
Enable MARS
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;MARS_Connection=yes;
Encrypt data sent over network
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;Encrypt=yes;
Attach a database file on connect to a local SQL Server Express instance
Driver={ODBC Driver 17 for SQL Server};Server=.SQLExpress;AttachDBFileName=c:dir\mydb.mdf;Database=dbName;Trusted_Connection=yes;
Database mirroring
If you connect to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Failover_Partner=myMirrorServerAddress;Database=myDataBase;Trusted_Connection=yes;
SQL Server 2008
Standard security
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;UID=myUsername;PWD=myPassword;
Trusted Connection
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;
Connecting to an SQL Server instance
The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.
Driver={ODBC Driver 17 for SQL Server};Server=serverNameinstanceName;Database=myDataBase;Trusted_Connection=yes;
Using a non-standard port
If your SQL Server listens on a non-default port you can specify that using the servername,xxxx syntax (note the comma, it’s not a colon).
Driver={ODBC Driver 17 for SQL Server};Server=myServerName,myPortNumber;Database=myDataBase;UID=myUsername;PWD=myPassword;
Enable MARS
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;MARS_Connection=yes;
Encrypt data sent over network
Driver={ODBC Driver 17 for SQL Server};Server=serverAddress;Database=databaseName;Trusted_Connection=yes;Encrypt=yes;
Attach a database file on connect to a local SQL Server Express instance
Driver={ODBC Driver 17 for SQL Server};Server=.SQLExpress;AttachDBFileName=c:dir\mydb.mdf;Database=dbName;Trusted_Connection=yes;
Database mirroring
If you connect to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.
Driver={ODBC Driver 17 for SQL Server};Server=myServerAddress;Failover_Partner=myMirrorServerAddress;Database=myDataBase;Trusted_Connection=yes;
Join the Chocolatey Team on our regular monthly stream where we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.
Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You’ll have a chance to have your questions answered in a live Ask Me Anything format.
Livestream from
Thursday, 06 October 2022
We recently released our largest update to Chocolatey Central Management so far. Join Gary and Steph to find out more about Chocolatey Central Management and the new features and fixes we’ve added to this release.
Watch On-Demand
Webinar Replay from
Wednesday, 30 March 2022
At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!
Watch On-Demand
Livestream from
Thursday, 9 June 2022
Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.
Watch On-Demand
Livestream from
Thursday, 04 August 2022
Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We’ll talk about some cool new features, long term asks from Customers and Community and how you can get involved!
Watch On-Demand
Livestreams from
October 2022
For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.
Watch On-Demand
Livestream from
Thursday, 03 November 2022
Join Paul and Gary for this months Chocolatey product livestream where we look at the latest release of Chocolatey 1.2.0, Chocolatey Licensed Extension 5.0.0 and shine a spotlight on the new hook scripts functionality. This opens up so many possibilities for Chocolatey CLI users!
Watch On-Demand
Livestream from
Tuesday, 29 November 2022
Join Josh as he adds the ability to manage Chocolatey GUI config and features with the Chocolatey Ansible Collection.
Watch On-Demand
Webinar from
Tuesday, 13 December 2022
Join Gary, Paul, and Maurice as they introduce and demonstrate how to use Chocolatey! Questions will be answered live in an Ask Me Anything format.
Watch On-Demand
Detangling the New Microsoft SQL Server ODBC and OLEDB Drivers
Detangling the New Microsoft SQL Server ODBC and OLEDB Drivers
Some of you may already know that Microsoft backtracked on their planned deprecation of OLEDB and provided a new OLEDB driver. However, it can be a head-scratcher to figure what you should be using. When we were using SQL Server Native Client, it was pretty easy — the Native Client had both OLEDB and ODBC shipped in a single DLL file, making for easy installation. All you had to make sure you were using the right version of Native Client.
With SQL Server now available on Linux, it no longer makes sense to distribute Native Client, since Linux in general don’t support OLEDB, which is mainly a Windows-only technology used mainly by Microsoft products. For that reason, Microsoft has not opted to combine both ODBC and OLEDB into a single DLL. If your application contains VBA code that uses both DAO and ADO, then you would need to install two different providers to get the latest feature and supports for both ODBC and OLEDB respectively.
The naming convention can be a bit confusing because many people will loosely refer to various drivers as simply just “ODBC driver” or “OLEDB provider”. So let’s get the names straight. We’ll start with identifying the deprecated versions and then look at the current versions.
Deprecated Versions
By default, all versions of Windows come with two SQL Server data access client libraries pre-installed:
Microsoft OLE DB Provider for SQL Server (also known as SQLOLEDB)
Microsoft SQL Server ODBC Driver (also known as SQLODBC)
It is very important to note that those are DEPRECATED. Those are targeting SQL Server 2000 and lack new features introduced since. Windows will not ship any new drivers or update those via its Windows Update. Going forward, you, the application developer, must provide the drivers of appropriate version to use with your application, rather than relying on the ones provided by Windows. Do NOT use those in your current development.
Current Versions
With that out of way, let’s look at the correct ODBC driver and OLEDB provider we may want to use.
ODBC Driver 17 for SQL Server
At the time of writing, the ODBC Driver 17 for SQL Server is the latest driver and can be downloaded in the provided link. The connection string looks like this:
ODBC;DRIVER=ODBC Driver 17 for SQL Server;SERVER=myServer;DATABASE=myDatabase;
OLE DB Driver 18 for SQL Server
At the time of writing, the OLEDB driver 18 is the latest driver. Even though the version is one higher, the feature set is equivalent to the ODBC Driver 17 for SQL Server. The connection string looks like this:
Provider=MSOLEDBSQL;Server=myServer; Database=myDataBase;
32-bit or 64-bit?
One common question that comes up is whether one should install the 64-bit or 32-bit versions of the driver. The answer is same regardless of which versions we are discussing and it’s always dependent on the OS, not the Office. Therefore, if you are running 32-bit Access on 64-bit Windows, you would want to install 64-bit drivers. This will include the 32-bit components needed for the 32-bit Access to run with.
Can I use SQL Server Native Client?
Officially, SQL Server Native Client are supported up to SQL Server 2012. However, you can still use it to connect to newer versions of SQL Server. There are several features that are missing from the Native Client. As time proceed, they will become increasingly unsuited for your needs, especially with Azure technology. Though you might be able to continue using it for your existing applications, we encourage that you plan new developments using the separate ODBC and OLEDB drivers and migrate your existing applications when possible. You must migrate when there’s a need to make use of new technologies that are only supported by those newer drivers (examples include Azure Authentication or Always Encrypted feature).
Do I need both?
Only if you do use both DAO and ADO. Generally speaking, all forms and reports and Access queries are always using DAO. The only time you might use ADO is within VBA code. So if you do not use ADO, you can get away with only the ODBC driver and that should suffice for your need. That means when you normally link your tables, you would use code similar to the following:
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Set db = CurrentDb
Set tdf = db.CreateTableDef
tdf.Name = “MyRemoteTable”
tdf.SourceTableName = “dbo.MyRemoteTable”
tdf.Connect = “ODBC;DRIVER=ODBC Driver 17 for SQL Server;SERVER=myServer;DATABASE=myDatabase;”
db.TableDefs.Append
The syntax used for tdf.Connect works for pass-through querydef or even for DAO.Workspace.OpenDatabase method’s Connect property.
It is legal to open ADO connections using ODBC but the downside is that you end up going through more layers because you’d be using OLEDB provider for ODBC to connect with the ODBC driver 17 for SQL Server. If you still would rather use ODBC anyway, you can use the following code to use ODBC over OLEDB:
Dim con As ADODB.Connection
Set con = New ADODB.Connection
con.ConnectionString = “DRIVER=ODBC Driver 17 for SQL Server;SERVER=myServer;DATABASE=myDatabase;”
con.Open
It’s better to avoid the extra layer and use the OLEDB directly. You can use this code to get best performance with your ADO code:
Dim con As ADODB.Connection
Set con = New ADODB.Connection
con.ConnectionString = “Provider=MSOLEDBSQL;Server=myServer; Database=myDataBase;”
con.Open
Thus, the only time you will actually need and use the new OLEDB driver for SQL Server is when you do have ADO code in your application and want to use the full capability of ADO, which needs to be enabled by the underlying OLEDB driver.
Additional Reference
Roadmap for Microsoft Data Access Technology
Spread the knowledge!
Comments are closed.
Page load link
Go to Top