Using Caché with ODBC
Using an InterSystems Database as an ODBC Data Source on Windows
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

This chapter describes how to create a DSN for an InterSystems database on Windows, which you can do either via the Control Panel or by creating a file DSN.

Creating a DSN with the ODBC Data Source Administrator
To create a DSN, you can use the Windows ODBC Data Source Administrator to access the InterSystems ODBC Data Source Setup dialog box:
The following illustration shows an instance of the InterSystems ODBC Data Source Setup dialog box with all required fields filled in:
InterSystems ODBC Data Source Setup Dialog Box
The fields are listed below and are required unless otherwise specified:
Data Source and Connection sections
Authentication Method section
Misc section (optional settings)
After you have created the DSN, you can use the Test Connection button to see if your data source is working correctly.
The Ping button attempts to ping the DSN host machine for the number of times specified in the #Times field. A popup window will display information on ping success or failure.
Selecting the Correct ODBC Data Source Administrator Version
In 64-bit releases of Windows, there are both 32-bit and 64-bit versions of the Data Source Administrator. Select the appropriate version as follows:
Note:
Both versions of the ODBC Data Source Administrator executable are named odbcad32.exe, but they are in different locations. In Windows releases prior to Windows 8, the 64-bit executable is in %windir%\System32, and the 32-bit executable is in %windir%\SysWOW64 (which may be the opposite of what you expect). Use the one in SysWOW64 to create DSNs based on the 32-bit drivers.
Using File DSNs and DSN-less Connections
DSN information is typically stored in the Windows Registry (under [HKLM\SOFTWARE\ODBC]), but you can also specify connection information in a file DSN (a text file with extension .dsn).
A file DSN can be created with either the ODBC Data Source Administrator (from the File DSN tab) or a standard text editor. For detailed information, see the Microsoft support site (search on "file DSN").
The file DSN can specify the name of an existing DSN to use, for example:
  [ODBC]
  DSN=InterSystems ODBC Sample Code
or it can specify a set of key-value pairs that specify the same connection information as a standard registry entry. For example:
TBD
A file DSN is invoked by a call to SQLDriverConnect.
File DSNs are typically stored in \Program Files\Common Files\ODBC\Data Sources, but you can use the File DSN tab in the ODBC Data Source Administrator to define a different default location.
ODBC Connection Strings
SQLDriverConnect takes a connection string argument that can specify connection information in three different ways:
DSN connection
Specifies the name of a regular DSN in the registry. For example:
"DSN=ODBC Samples;UID=myUsername;PWD=;"
FILEDSN connection
Specifies a file DSN rather than a registry entry. For example:
"FILEDSN=c:\ODBC_Samples.dsn;UID=myUsername;PWD=;"
DSN-less connection
Defines all connection information directly in the connection string. For example:
"Driver=Cache ODBC Driver;Host=127.0.0.1;Port=56772;Database=USER;UID=myUsername;PWD="