docs.intersystems.com
Home / Using the InterSystems ODBC Driver / Using an InterSystems Database as an ODBC Data Source on Windows

Using the InterSystems ODBC Driver
Using an InterSystems Database as an ODBC Data Source on Windows
Previous section           Next section
InterSystems: The power behind what matters   
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.
Note:
Windows Power Shell Commands
Windows also offers a set of Power Shell commands for manipulating DSNs from the command line. For details, see the Power Shell documentation for Windows Data Access Components (WDAC).
Selecting the Correct ODBC Data Source Administrator Version
On Windows 64-bit, use the Windows Control Panel ODBC Administrator to create user DSNs that function for both 32- and 64-bit programs. To configure a system DSN for a 32-bit program, run %SystemRoot%\SysWow64\odbcad32.exe.
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.
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=InterSystems ODBC Driver;Host=127.0.0.1;Port=56772;Database=USER;UID=myUsername;PWD="


Previous section           Next section
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-04-23 13:43:21