This may be your only option if, when you try to add the data source in ODBC Data Source Administrator, you get the error "ODBC Administrator has stopped working." The other data source creation methods that are listed in this article cause ODBC configuration dialogs boxes to display. These dialog boxes may also be affected by the same issue that's preventing you from using ODBC Data Source Administrator to add a data source.
ODBC data sources are stored in the Windows registry. System ODBC data sources are stored in HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
. User ODBC data sources are stored in HKEY_CURRENT_USER\Software\ODBC\ODBC.INI
.
The following example .reg
file creates a system data source for the MongoDB ODBC driver, if imported into the registry:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\MongoDB System DSN] "Driver"="C:\\Program Files (x86)\\Easysoft Limited\\Easysoft MongoDB ODBC Driver\\libs\\esmg.dll" "Description"="" "User"="" "Password"="" "Server"="localhost" "Database"="faa" "MD_User"="" "MD_Password"="" "MD_Server"="" "MD_Database"="" "Logging"="No" "Logfile"="" "DefaultW"="No" "IgnoreAuth"="No" "Preview"=""
Note that the example is for an Easysoft ODBC driver (as are the examples throughout this article). You will need to alter it for ODBC drivers from other vendors. (Change the driver name and connection string attributes. Refer to the documentation for your ODBC driver for further information.)
On 64-bit Windows, System data sources for 32-bit ODBC drivers are stored in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI
.
ODBCConf is a Windows command line utility that enables you to install and configure ODBC drivers and configure ODBC data sources.
odbcconf /A {CONFIGSYSDSN "Easysoft Salesforce ODBC Driver" "DSN=Salesforce System DSN|UID=myname@mydomain|PWD=p455w0rd|Token=A1B2cDefG3HijKlMNOPQRS45"}
%WINDIR%\SysWOW64\odbcconf /A {CONFIGSYSDSN "Easysoft ODBC-Derby Driver" "DSN=32-bit Derby System DSN|Server=localhost|Database=seconddb"}
ODBC Test, which is included in the Microsoft Data Access Components (MDAC) 2.8 Software Development Kit, provides a graphical way to run ODBC API calls.
To create an ODBC data source from ODBC Test, on the Installer menu, choose Data Sources and then choose SQLConfigDataSource
. Complete the SQLConfigDataSource
dialog box. The following example values are for Easysoft's Salesforce ODBC driver:
fRequest | ODBC_ADD_DSN |
---|---|
lpszDriver | Easysoft Salesforce ODBC Driver |
lpszAttributes | DSN=Salesforce User DSN;UID=myname@mydomain;PWD=p455w0rd;TOKEN=A1B2cDefG3HijKlMNOPQRS45 |
Windows PowerShell is a command-line and scripting environment from Microsoft. Built-in Windows PowerShell commands, called cmdlets, enable users to control and automate the administration of the Windows operating system and applications that run on Windows.
Starting in Windows 8, a number of PowerShell cmdlets are provided for listing and managing ODBC drivers and data sources. This sample cmdlet adds a 64-bit System ODBC data source for Easysoft's Derby ODBC driver:
PS C:\> Import-Module Wdac PS C:\> Add-OdbcDsn "64-bit Derby System DSN" -DriverName "Easysoft ODBC-Derby Driver" -DsnType System -Platform 64-bit -SetPropertyValue @("Database=nativedb") -PassThru