Creating a data source v16

When a client application tries to establish a connection with a server, it typically provides a data source name (DSN). The driver manager looks through the ODBC configuration database for a data source whose name matches the DSN provided by the application.

On a Linux or Unix host, data sources are defined in a file usually named /etc/odbc.ini. The name and location can vary. Use the following command to find out where unixODBC is searching for data source definitions:

$ odbc_config --odbcini --odbcinstini

On a Windows host, data sources are typically defined in the Windows registry.

You can also store a data source definition, called a File DSN, in a plain-text file. A typical data source definition for the EDB-ODBC driver looks like this:

$ cat /etc/odbc.ini
[EnterpriseDB]
Description = EnterpriseDB DSN
Driver = EnterpriseDB
Trace = yes
TraceFile = /tmp/odbc.log
Database = edb
Servername = localhost
UserName = enterprisedb
Password = manager
Port = 5444

The first line in the data source is the data source name. The name is a unique identifier, enclosed in square brackets. The data source name is followed by a series of keyword=value pairs that identify individual connection properties that make up the data source.

The ODBC Administrator utility on Windows creates named data sources for ODBC connections. If you’re using Windows, the tool is called the ODBC Data Source Administrator. If you are using Linux, you can create the named data sources using the odbc.ini file in a text editor of your choice.

Adding a data source definition in Windows and Adding a data source definition in Linux walk you through adding a data source in Windows using the graphical tool and Linux using the command line. During the process of defining a data source, you’ll be required to specify a set of connection properties. EDB-ODBC connection properties contains information about optional data source connection properties. You can specify connection properties with a graphical tool (on Windows) or edit the odbc.ini file with a text editor (on Linux).