Using Caché with ODBC
Using an InterSystems Database as an ODBC Data Source on Windows
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.
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
Specifies the user-defined name of the DSN.
Optional. Provides user-defined information about the DSN.
Host IP Address
Specifies the IP address to be used by the ODBC connection in dotted decimal or dotted quad form, such as 127.0.0.1
Host Port Number
Specifies the port to be used by the ODBC connection. The default for InterSystems is 1972.
Authentication Method section
Misc section (optional settings)
Optional. If selected, enables the InterSystems ODBC client driver’s static cursor support. If this flag is off, then the cursor support provided by the ODBC Cursor Library will be used. In general, this flag should be off unless you have a specific reason for not using the ODBC Cursor Library.
Disable Query Timeout
Optional. If selected, causes the ODBC client driver to ignore the value of the ODBC query timeout setting.
The ODBC query timeout setting specifies how long a client should wait for a specific operation to finish. If an operation does not finish within the specified time, it is automatically cancelled. The ODBC API provides functions to set this timeout value programmatically. Some ODBC applications, however, hard-code this value. If you are using an ODBC application that does not allow you to set the timeout value and the timeout value is too small, you can use the Disable Query Timeout option to disable timeouts.
Use Locale Decimal Symbol
Optional. When selected, specifies the use of the current locale's decimal separator; not checking this sets the decimal separator in the process to a period ("."
) regardless of the locale. This value can have an affect when the ODBC connection is interoperating with an application that uses the decimal separator as defined for the current locale.
Unicode SQL Types
Optional. This functionality is only relevant if you are working with a multibyte character set, such as in Chinese, Hebrew, Japanese, or Korean locales. If you are only using single-byte character set data, do not select this check box. If selected, this option turns on reporting of a Unicode SQL type (SQL_WVARCHAR (-9) SQLType
) for string data. This allows some Microsoft applications to allocate the properly sized buffers to hold multibyte data.
After you have created the DSN, you can use the Test Connection
button to see if your data source is working correctly.
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.
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:
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.
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:
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:
ODBC Connection Strings
takes a connection string argument that can specify connection information in three different ways:
Specifies the name of a regular DSN in the registry. For example:
Specifies a file DSN rather than a registry entry. For example:
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="
© 1997-2019 InterSystems Corporation, Cambridge, MA