KNOWLEDGE BASE

Error "Driver's SQLAllocHandle on SQL_HANDLE_ENV failed" When Connecting to Microsoft SQL or Azure Server


Published: 23 Jan 2017
Last Modified Date: 19 Sep 2019

Issue

When attempting to connect to Microsoft SQL or Azure Server, the following error can occur:
 
[Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed

Environment

  • Tableau Desktop
  • Microsoft SQL Server
  • Microsoft Azure Server

Resolution

Option 1: 

  1. Uninstall all currently installed SQL Server Drivers via Apps and Features (Windows 10) or Programs and Features (Older Windows versions).
  2. Download and reinstall the appropriate Microsoft SQL Server driver from Driver Download

Option 2:

Uninstall and Reinstall Tableau Desktop.

Option 3:
Use a .tdc file similar to the following one that directs Tableau Desktop to use the driver that comes with the SQL Server Native Client. For more information on .tdc files, see Create a .tdc file.

<?xml version='1.0' encoding='utf-8' ?>
<connection-customization class='sqlserver' enabled='true' version='2019.1'>
<vendor name='sqlserver'/>
<driver name='sqlserver'/>
<customizations>
<customization name='odbc-connect-string-extras' value='DRIVER=SQL Server Native Client (VALUE)' />
</customizations>
</connection-customization>


Replace "VALUE" with the version of the driver you are using.
Replace '2019.1' with the version of Tableau Desktop you are using.

Important: Tableau does not test or provide support for creating TDC files. These files should be used as a tool to explore or occasionally address issues with your data connection. Creating and maintaining TDC files requires careful manual editing, and there is no support for sharing these files.

Cause

The database driver did not install correctly, or unsupported database driver versions were installed.
Did this article resolve the issue?