ODBC Connections

This article details the way to manage ODBC connections manually using the registry.

These registry entries can be added in an installation package (in a MSI, MST, or imported using a script).

No reboot or log-off / logon is required.

.

Create a New Data Source to SQL Server

.

Registry

Create a .reg file with the following content:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources]
"MY_DSN"="SQL Server"

[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\MY_DSN]
"Driver"="C:\\Windows\\SysWOW64\\sqlsrv32.dll"
"Description"="My Data Source"
"Server"="MyServer"
"Database"="MyDataBase"
"LastUser"="MyLogin"

.

User Interface

odbc01

 

odbc02

 

odbc03

.

Using a Trusted Connection

To use Trusted Connection, add the following registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\MY_DSN]
"Trusted_Connection"="Yes"

odbc04