Getting started

This section shows you how to install the Easysoft ODBC-DB2 Driver and configure the ODBC data source that stores the connection details for your Db2 database. You’re then ready to work with Db2 data in your application.

Installing the Easysoft ODBC-DB2 Driver

Install the Easysoft ODBC-DB2 Driver on the computer where the application you want to connect to Db2 is running.

Installing on Linux or UNIX

The installation can be done by anyone with root access.

  1. Download the Easysoft ODBC-DB2 Driver distribution for your client application platform.

    If your client application is 64-bit, choose the 64-bit driver distribution form the Platforms list. If your client application is 32-bit, choose the 32-bit driver distribution form the Platforms list.

  2. Copy the distribution to a temporary directory on the machine where the application you want to connect to Db2 is installed.

  3. Unpack the distribution and cd into the resultant directory.

  4. As root, run:

    ./install
  5. Follow the onscreen instructions to progress through the installation.

Further information

Preinstallation requirements

To install the Easysoft ODBC-DB2 Driver you need:

  • The Bourne shell in /bin/sh. If your Bourne shell is not located there, you may need to edit the first line of the installation script.

  • Various commonly used commands such as:

    grep, awk, test, cut, ps, sed, cat, wc, uname, tr, find, echo, sum, head, tee, id

If you do not have any of these commands, they can usually be obtained from the Free Software Foundation. As the tee command does not work correctly on some systems, the distribution includes a tee replacement.

  • Depending on the platform, you’ll need up to 10 MB of temporary space for the installation files and up to 10 MB of free disk space for the installed programs. If you also install the unixODBC Driver Manager, these numbers increase by approximately 1.5 MB.

  • For Easysoft licensing to work, you must do one of the following:

    • Install the Easysoft ODBC-DB2 Driver in /usr/local/easysoft.

    • Install the Easysoft ODBC-DB2 Driver elsewhere and symbolically link /usr/local/easysoft to wherever you chose to install the software.

The installation will do this automatically for you so long as you run the installation as someone with permission to create /usr/local/easysoft.

  • Install the Easysoft ODBC-DB2 Driver elsewhere and set the EASYSOFT_ROOT environment variable. For more information about setting the EASYSOFT_ROOT environment variable, refer to Post installation steps for non-root installations.

    • An ODBC Driver Manager.

Easysoft ODBC-DB2 Driver distributions include the unixODBC Driver Manager.

  • You do not have to be the root user to install, but you will need permission to create a directory in the chosen installation path. Also, if you are not the root user, it may not be possible for the installation to:

    1. Register the Easysoft ODBC-DB2 Driver with unixODBC.

    2. Create the example data source in the SYSTEM odbc.ini file.

    3. Update the dynamic linker entries (some platforms only).

If you are not root, these tasks will have to be done manually later.

We recommend that you install all components as the root user.

What you can install

This distribution contains:

  • The Easysoft ODBC-DB2 Driver.

  • The unixODBC Driver Manager.

You need an ODBC Driver Manager to use the Easysoft ODBC-DB2 Driver from your applications. The distribution therefore contains the unixODBC Driver Manager. Most (if not all) UNIX and Linux applications support the unixODBC Driver Manager. For example, Perl DBD::ODBC, PHP, Python, and so on.

You do not have to install the unixODBC Driver Manager included with this distribution. You can use an existing copy of unixODBC. For example, a version of unixODBC installed by another Easysoft product, a version obtained from your operating system vendor or one that you built yourself. However, as Easysoft ensure that the unixODBC distributed with the Easysoft ODBC-DB2 Driver has been tested with that driver, we recommend you use it.

If you choose to use an existing unixODBC Driver Manager, the installation script will attempt to locate it. The installation script looks for the ODBC Driver Manager in the standard places. If you have installed it in a non-standard location, the installation script prompts you for the location. The installation primarily needs unixODBC’s odbcinst command to install drivers and data sources.

Where to install

This installation needs a location for the installed files. The default location is /usr/local.

At the start of the installation, you’re prompted for an installation path. All files are installed in a subdirectory of your specified path called easysoft. For example, if you accept the default location /usr/local, the product will be installed in /usr/local/easysoft and below.

If you choose a different installation path, the installation script tries to symbolically link /usr/local/easysoft to the easysoft subdirectory in your chosen location. This allows us to distribute binaries with built in dynamic linker run paths. If you are not root or the path /usr/local/easysoft already exists and is not a symbolic link, the installation will be unable to create the symbolic link. For information about how to correct this manually, refer to Post installation steps for non-root installations.

Note that you cannot license Easysoft products until either of the following is true:

  • /usr/local/easysoft exists either as a symbolic link to your chosen installation path or as the installation path itself.

  • You have set EASYSOFT_ROOT to installation_path/easysoft.

Changes made to your system

The installation script installs files in subdirectories of the path requested at the start of the installation, Depending on what is installed, a few changes may be made to your system:

  1. If you choose to install the Easysoft ODBC-DB2 Driver into unixODBC, unixODBC’s odbcinst command will be run to add an entry to your odbcinst.ini file. You can locate this file with odbcinst -j. (odbcinst is in installation_path/easysoft/unixODBC/bin, if you are using the unixODBC included with this distribution.)

  2. The installation script installs an example data source into unixODBC. This data source will be added to your SYSTEM odbc.ini file. You can locate your SYSTEM odbc.ini file by using odbcinst -j. The data source will look similar to this:

  3. Dynamic linker. On operating systems where the dynamic linker has a file listing locations for shared objects (Linux and FreeBSD), the installation script will attempt to add paths under the path you provided at the start of the installation to the end of this list.

    • On Linux, this is usually the file /etc/ld.so.conf.

    • On FreeBSD this is usually the file /etc/defaults/rc.conf.

Installing alongside other existing Easysoft product installations

Each Easysoft distribution contains common files shared between Easysoft products. These shared objects are placed in installation_path/easysoft/lib. When you run the installation script, the dates and versions of these files are compared with the same files in the distribution. The files are only updated if the files being installed are newer or have a later version number.

You should ensure that nothing on your system is using Easysoft software before starting an installation. This is because on some platforms, files in use cannot be replaced. If a file cannot be updated, you get a warning during the installation. All warnings are written to a file called warnings in the directory you unpacked the distribution into.

If the installer detects you’re upgrading a product, the installer will suggest you delete the product directory to avoid having problems with files in use. An alternative is to rename the specified directory.

If you are upgrading, you will need a new license from Easysoft to use the new driver.

Gathering information required during the installation

During the installation, you’re prompted for various pieces of information. Before installing, you need to find out whether you have unixODBC already installed and where it is installed. The installation script searches standard places like /usr and /usr/local.

However, if you installed the Driver Manager in a non-standard place and you do not install the included unixODBC, you will need to know the location.

Unpacking the distribution The distribution for UNIX and Linux platforms is a tar file. To extract the installation files from the tar file, use:

tar -xvf odbc-db2-1.0.0-linux-x86-64-ul64.tar

This creates a directory with the same name as the tar file (without the .tar postfix) containing further archives, checksum files, an installation script and various other installation files.

Change into the directory created by unpacking the tar file to run the installation script. For example:

# cd odbc-db2-1.0.0-linux-x86-64-ul64

License to use

The end-user license agreement (EULA) is in the file license.txt. Be sure to understand the terms of the agreement before continuing, as you’re required to accept the license terms at the start of the installation.

Answering questions during the installation

Throughout the installation, you’re prompted to answer some questions. In each case, the default choice displays in square brackets and you need only press Enter to accept the default. If there are alternative responses, these are shown in round brackets; to choose one of these, type the response and press Enter.

For example:

Do you want to continue? (y/n) [n]:

The possible answers to this question are y or n. The default answer when you type nothing and press Enter is n.

Running the installer

If you are considering running the installation as a non root user, we suggest you review this carefully as you will have to get a root user to manually complete some parts of the installation afterwards. We recommend installing as the root user. (If you’re concerned about the changes that will be made to your system, refer to Changes made to your system.)

To start the installation, run:

./install

You need to:

  • Confirm your acceptance of the license agreement by typing "yes" or "no". For more information about the license agreement, refer to License to use.

  • Supply the location where the software is to be installed.

We recommend accepting the default installation path.

For more information, refer to Where to install.

Locating or installing unixODBC

We strongly recommend you use the unixODBC Driver Manager because:

  • The installation script is designed to work with unixODBC and can automatically add Easysoft ODBC-DB2 Driver and data sources during the installation.

  • Most applications and interfaces that support ODBC are compatible with unixODBC. The Easysoft ODBC-DB2 Driver and any data sources that you add during the installation are automatically available to your applications and interfaces therefore.

  • The unixODBC project is currently led by Easysoft developer Nick Gorham. This means that there is a great deal of experience at Easysoft of unixODBC in general and of supporting the Easysoft ODBC-DB2 Driver running under unixODBC. It also means that if you find a problem in unixODBC, it’s much easier for us to facilitate a fix.

The installation starts by searching for unixODBC. There are two possible outcomes here:

  1. If the installation script finds unixODBC, the following message displays:

    Found unixODBC under path and it is version n.n.n
  2. If the installation script can’t find unixODBC in the standard places, you will be asked whether you have it installed.

If unixODBC is installed, you need to provide the unixODBC installation path. Usually, the path required is the directory above where odbcinst is installed. For example, if odbcinst is in /opt/unixODBC/bin/odbcinst, the required path is /opt/unixODBC.

If unixODBC is not installed, you should install the unixODBC included with this distribution.

If you already have unixODBC installed, you do not have to install the unixODBC included with the distribution, but you might consider doing so if your version is older than the one we provide.

The unixODBC in the Easysoft ODBC-DB2 Driver distribution is not built with the default options in unixODBC’s configure line.

Option Description

--prefix=/etc

This means the default SYSTEM odbc.ini file where SYSTEM data sources are located is /etc/odbc.ini.

--enable-drivers=no

This means other ODBC drivers that come with unixODBC are not installed.

--enable-iconv=no

This means unixODBC does not look for libiconv. Warnings about not finding an iconv library were confusing our customers.

--enable-stats=no

Turns off unixODBC statistics, which use system semaphores to keep track of used handles. Many systems do not have sufficient semaphore resources to keep track of used handles.

--enable-readline=no

This turns off readline support in isql. We did this because it ties isql to the version of libreadline on the system we build on. We build on as old a version of the operating system as we can for forward compatibility. Many newer Linux systems no longer include the older readline libraries and so turning on readline support makes isql unusable on these systems.

--prefix=/usr/local/easysoft/unixODBC

This installs unixODBC into /usr/local/easysoft/unixODBC.

Installing the Easysoft ODBC driver

The Easysoft ODBC-DB2 Driver installation script:

  • Installs the driver.

  • Registers the driver with the unixODBC Driver Manager.

    If the Easysoft ODBC-DB2 Driver is already registered with unixODBC, a warning displays that lists the drivers unixODBC knows about. If you’re installing the Easysoft ODBC-DB2 Driver into a different directory than it was installed before, you need to edit your odbcinst.ini file after the installation and correct the Driver and Setup paths. unixODBC’s odbcinst doesn’t update these paths if a driver is already registered.

  • Creates an example Easysoft ODBC-DB2 Driver data source. If unixODBC is installed and you registered the Easysoft ODBC-DB2 Driver with unixODBC, the installation script adds example data source to your odbc.ini file.

Licensing

The installation_path/easysoft/license/licshell program lets you obtain or list licenses.

Licenses are stored in installation_path/easysoft/license/licenses.

After obtaining a license, you should make a backup copy of this file.

The installation script asks you if you want to request an Easysoft ODBC-DB2 Driver license:

Would you like to request a Easysoft ODBC-DB2 Driver license now (y/n) [y]:

You do not need to obtain a license during the installation, you can run licshell after the installation to obtain or view licenses.

If you answer y, the installation runs the licshell script.

To obtain a license automatically, you need to be connected to the Internet and allow outgoing connections to license.easysoft.com on port 8884. If you’re not connected to the Internet or don’t allow outgoing connections on port 8884, the License Client can create a license request file that you can email to us.

When you start the License Client, the following menu displays:

[0] exit
[1] view existing license
[n] obtain a license for the desired product.

To obtain a license, select one of the options from [2] onwards for the product you’re installing. The License Client then runs a program that generates a key that’s used to identify the product and operating system (we need this key to license you).

After you have chosen the product to license (Easysoft ODBC-DB2 Driver), you need to supply:

  • Your full name.

  • Your company name.

  • An email contact address. This must be the email address that you used when you registered on the Easysoft web site.

  • A reference number (also referred to as an authorization code). When applying for a trial license, press Enter when prompted for a reference number. This field only applies to full (paid) licenses.

You’re then asked to choose how you want to obtain the license.

The choices are:

  • [1] Automatically by contacting the Easysoft License Daemon

    This requires a connection to the Internet and the ability to support an outgoing TCP/IP connection to license.easysoft.com on port 8884.

  • [2] Write information to file

    The license request is output to license_request.txt.

  • [3] Cancel this operation

If you choose to obtain the license automatically, the License Client true to open a TCP/IP connection to license.easysoft.com on port 8884 and send the details you supplied along with your machine number. No other data is sent. The data sent is transmitted as plain text, so if you want to avoid the possibility of this information being intercepted by someone else on the Internet, you should choose [2] and send the the request to us. The License daemon returns the license key, print it to the screen and make it available to the installation script in the file licenses.out.

If you choose option [2], the license request is written to the file license_request.txt. You should then exit the License Client by choosing option [0] and complete the installation. After you have sent the license request to us, we’ll return a license key. Add this to the end of the file installation_path/easysoft/license/licenses.

Post installation steps for non-root installations

If you installed the Easysoft ODBC-DB2 Driver as a non-root user (not recommended), there may be some additional steps you to do manually:

  1. If you attempt to install the Easysoft ODBC-DB2 Driver under the unixODBC Driver Manager and you do not have write permission to unixODBC’s odbcinst.ini file, the driver can’t be added.

    You can manually install the driver under unixODBC by adding an entry to the odbcinst.ini file. Run odbcinst -j to find out the location of the DRIVERS file then append the lines from drv_template file to odbcinst.ini. (drv_template is in the directory where the Easysoft distribution was untarred to.)

  2. No example data sources can be added into unixODBC if you do not have write permission to the SYSTEM odbc.ini file. Run odbcinst -j to find out the location of the SYSTEM DATA SOURCES file then add your data sources to this file.

  3. On systems where the dynamic linker has a configuration file defining the locations where it looks for shared objects (Linux and FreeBSD), you need to add:

    installation_path/easysoft/lib
    installation_path/easysoft/unixODBC/lib

    The latter entry is only required if you installed the unixODBC included with this distribution. Sometimes, after changing the dynamic linker configuration file, you need to run a program to update the dynamic linker cache. (For example, /sbin/ldconfig on Linux.)

  4. If you didn’t install the Easysoft ODBC-DB2 Driver in the default location, you need to do one of the following:

    • Link /usr/local/easysoft to the easysoft directory in your chosen installation path.

      For example, if you installed in /home/user, the installation creates /home/user/easysoft and you need to symbolically link /usr/local/easysoft to /home/user/easysoft:

      ln -s /home/user/easysoft /usr/local/easysoft
    • Set and export the EASYSOFT_ROOT environment variable to installation_path/easysoft.

  5. If your system doesn’t have a dynamic linker configuration file, you need to add the paths listed in step 3 to whatever environment path the dynamic linker uses to locate shared objects. You may want to add these paths to a system file run whenever someone logs. For example, /etc/profile.

    The environment variable depends on the dynamic linker. Refer to your ld or ld.so man page. It is usually:

    LD_LIBRARY_PATH, LIBPATH, LD_RUN_PATH, or SHLIB_PATH.

Uninstalling on Linux or UNIX

There is no automated way to remove the Easysoft ODBC-DB2 Driver in this release. However, removal is quite simple. To do this:

  1. Change directory to installation_path/easysoft and delete the product directory. installation_path is the Easysoft ODBC-DB2 Driver installation directory, by default /usr/local.

  2. If you had to add this path to the dynamic linker search paths (for example, /etc/ld.so.conf on Linux), remove it. You may have to run a linker command such as /sbin/ldconfig to get the dynamic linker to reread its configuration file. Usually, this step can only be done by the root user.

  3. If you were using unixODBC, the Easysoft ODBC-DB2 Driver entry needs to be removed from the odbcinst.ini file. To check whether the Easysoft ODBC-DB2 Driver is configured under unixODBC, use odbcinst -q -d. If the command output contains [Easysoft ODBC-DB2], uninstall the driver from unixODBC by using:

    odbcinst -u -d -n Easysoft ODBC-DB2

If a reduced usage count message is displayed, repeat this command until odbcinst reports that the driver has been removed.

  1. If you created any Easysoft ODBC-DB2 Driver data sources under unixODBC, you may want to delete these. To do this, first use odbcinst -j to locate USER and SYSTEM odbc.ini files. Then check those files for data sources that have the driver attribute set to Easysoft ODBC-DB2.

  2. Remove the install.info for the Easysoft ODBC-DB2 Driver from the /usr/local/easysoft directory.

Installing on Windows

The Windows installation can be done by anyone with local administrator privileges.

  1. Download the Easysoft ODBC-DB2 Driver installer.

  2. Follow the onscreen instructions to progress through the installation wizard.

Updating files that are in use

To avoid rebooting your computer, the Easysoft ODBC-DB2 Driver installer prompts you when files that it needs to update are in use by another application or service. This frees the locked files and allows the installation to complete without a system restart. The installer uses the Restart Manager to locate the applications that are using files that need updating. These applications are displayed in the Files in Use dialog box. To avoid a system restart, choose Automatically close applications and attempt to restart them after setup is complete. The Easysoft ODBC-DB2 Driver installer then uses Restart Manager to try to stop and restart each application or service in the list. If possible, Restart Manager restores applications to the same state that they were in before it shut them down.

Licensing

By default, the installer starts the Easysoft License Manager, because you can’t use the Easysoft ODBC-DB2 Driver until you have a license. If you choose not to run Easysoft License Manager as part of the installation process, run License Manager from the Easysoft group in the Windows Start menu when you’re ready to license the Easysoft ODBC-DB2 Driver. These types of license are available:

  • A free time-limited trial license which gives you free and unrestricted use of the product for a limited period (usually 14 days).

  • A full license if you have purchased the product. On purchasing the product you are given an authorization code, which you use to obtain a license.

To license the Easysoft ODBC-DB2 Driver:

  1. In License Manager, enter your contact details.

    You must complete the Name, E-Mail Address, and Company fields.

    The e-mail address must be the same as the one used to register at the Easysoft web site. Otherwise, you won’t be able to obtain a trial license.

  2. Choose Request License.

    You’re prompted to choose a license type.

  3. Do one of the following:

    • For a trial license, choose Time Limited Trial, and then choose Next.
      -Or-

    • For a purchased license, choose Non-expiring License, and then choose Next.

  4. Choose your product from the drop-down list when prompted, and then choose Next.

  5. For a purchased license, enter your authorization code when prompted, and then choose Next.

  6. Choose how to get your license when prompted.

  7. Do one of the following:

    • Choose On-line Request if your machine is connected to the internet and can make outgoing connections to port 8884.
      With this method, License Manager automatically requests and then applies your license.
      -Or-

    • Choose View Request. Then open a web browser and go to https://www.easysoft.com/support/licensing/trial_license.html or https://www.easysoft.com/support/licensing/full_license.html, as appropriate. In the web page, enter your machine number (labelled Number in the license request). For purchased licenses, you also need to enter your authorization code (labelled Ref in the license request).
      We’ll automatically email your license to the email address you supplied in License Manager.
      -Or-

    • Choose Email Request to email your license request to our licensing team.
      Once we’ve processed you request, we’ll email your license to the email address you supplied in License Manager.

  8. Close the License Manager windows and then choose Finish.

If you chose either View Request or Email Request, apply your license by double-clicking the email attachment when you get the license email from us. Alternatively, start License Manager from the Easysoft folder in the Windows Start menu. Then choose Enter License and paste the license in the space provided.

Once you’ve licensed the Easysoft ODBC-DB2 Driver, the installation is complete.

Repairing the installation

The installer can repair a broken Easysoft ODBC-DB2 Driver installation. For example, you can use the installer to restore missing Easysoft ODBC-DB2 Driver files or registry keys. To do this:

  1. In the Windows taskbar, enter Add or remove programs in the Windows search box.

  2. Select Easysoft ODBC-DB2 Driver in the list, and then choose Repair.

Uninstalling on Windows

This section explains how to remove the Easysoft ODBC-DB2 Driver from your system.

Removing Easysoft ODBC-DB2 Driver data sources

Easysoft ODBC-DB2 Driver data sources are not removed when you uninstall the Easysoft ODBC-DB2 Driver. You don’t therefore need to recreate your Easysoft ODBC-DB2 Driver data sources if you reinstall or upgrade. If you don’t want to keep your Easysoft ODBC-DB2 Driver data sources, use Microsoft ODBC Data Source Administrator to remove them, before uninstalling the Easysoft ODBC-DB2 Driver:

  1. In the Windows taskbar, enter Run in the Windows search box.

  2. In the Windows Run dialog box, enter:

    odbcad32.exe
  3. Locate your data source in either the User or System tab.

  4. Select the data source from the list, and then choose Remove.

    If the Remove button isn’t available, close ODBC Data Source Administrator, and then, in the Windows Run dialog box, enter:

    %windir%\syswow64\odbcad32.exe

    Repeat the previous two steps.

Removing the Easysoft ODBC-DB2 Driver

  1. In the Windows taskbar, enter Add or remove programs in the Windows search box.

  2. Select Easysoft ODBC-DB2 Driver in the list, and then choose Uninstall.

Easysoft product licenses are stored in the Windows registry. When you uninstall, your licenses are not removed, so you do not need to relicense the product if you reinstall or upgrade.

Connecting to Db2

Applications that support ODBC interface with an ODBC Driver Manager, which is included with the operating system, and also the Easysoft ODBC driver distribution on some platforms. One of the jobs that the ODBC Driver Manager does is to manage ODBC data sources. A data source specifies which ODBC driver to load, which data store to connect to, and how to connect to it.

Before setting up a data source, you must have successfully installed the Easysoft ODBC-DB2 Driver.

Connecting from Linux or UNIX

Creating an ODBC data source

There are two ways to create a data source to your Db2 data:

  • Create a SYSTEM data source, which is available to anyone who logs on to the computer where the Easysoft ODBC-DB2 Driver is installed.

    – Or –

  • Create a USER data source, which is only available to the user who is currently logged on to the computer where the Easysoft ODBC-DB2 Driver is installed.

By default, the Easysoft ODBC-DB2 Driver installation creates a sample SYSTEM data source named DB2_SAMPLE. If you’re using the unixODBC included in the Easysoft ODBC-DB2 Driver distribution, the SYSTEM odbc.ini file is in /etc.

If you built unixODBC yourself, or installed it from some other source, SYSTEM data sources are stored in the path specified with the configure option --sysconfdir=directory. If sysconfdir was not specified when unixODBC was configured and built, it defaults to /usr/local/etc.

If you accepted the default choices when installing the Db2, USER data sources must be created and edited in $HOME/.odbc.ini.

Notes

  • To display the directory where unixODBC stores SYSTEM and USER data sources, type odbcinst -j.

  • By default, you must be logged in as root to edit a SYSTEM data source defined in /etc/odbc.ini.

You can either edit the sample data source or create new data sources.

Each section of the odbc.ini file starts with a data source name in square brackets [ ] followed by a number of attribute=value pairs.

The Driver attribute identifies the ODBC driver in the odbcinst.ini file to use for a data source. When the Easysoft ODBC-DB2 Driver is installed into unixODBC, it places a Easysoft ODBC-DB2 entry into the odbcinst.ini file. You should always have Driver = Easysoft ODBC-DB2 in your Easysoft ODBC-DB2 Driver data sources therefore.

To configure a Easysoft ODBC-DB2 Driver data source, in your odbc.ini file, you need to specify:

  • The hostname or IP address of the Db2 server.

  • The database to connect to (Database).

  • A user who has permission to access this database (User).

  • The password for this user (Password).

For example:

[DB2_SAMPLE]
Driver          = Easysoft ODBC-DB2
Server          = localhost
Database        = sample
User            = db2admin
Password        = p455w0rd

The Easysoft ODBC-DB2 Driver must be able to find the following shared objects:

  • libodbcinst.so

    By default, this is located in /usr/local/easysoft/unixODBC/lib/libodbcinst.so.

  • libeslicshr.so

    By default, this is located in /usr/local/easysoft/lib/libeslicshr.so.

  • libessupp.so By default, this is located in /usr/local/easysoft/lib/libessupp.so.

You may need to set and export LD_LIBRARY_PATH, SHLIB_PATH, or LIBPATH (depending on your operating system and run-time linker) to include the directories where libodbcinst.so, libeslicshr.so, and libessupp.so are located.

The isql query tool lets you test your Easysoft ODBC-DB2 Driver data sources. To test the Easysoft ODBC-DB2 Driver connection:

  1. Change directory into /usr/local/easysoft/unixODBC/bin.

  2. Enter ./isql -v data_source, where data_source is the name of the target data source.

  3. At the prompt, enter an SQL query. For example:

    SQL> SELECT * FROM DEPT;

    –Or–

  4. Enter help to return a list of tables:

    SQL> help

Connecting from Windows

Creating an ODBC data source

  1. In the Windows taskbar search box, enter “Run”.

  2. Do one of the following:

    • If your application is 64-bit, in the Run dialog box, enter:

      odbcad32.exe

      -Or-

    • If your application is 32-bit, in the Run dialog box, enter:

      %windir%\syswow64\odbcad32.exe
      If your not sure whether your application is 32-bit or 64-bit, start your application, then in Windows Task Manager check whether your application’s process name contains (32-bit). For example, the process name for the 32-bit version of Excel is Microsoft Excel (32-bit); the process name for the 64-bit version of Excel is Microsoft Excel. On older versions of Windows, 32-bit applications contain *32 in the process name rather than (32-bit).
      For applications such as Oracle or SQL Server that run as a service, check the *Background processes* list rather than the Apps list in Task Manager.
      If you’re running a programming language from within a Windows command-line shell (for example, Command or PowerShell), in your shell, run the .exe file for the programming language. For example, run perl, php, python, or node. In Task Manager, expand the process list for Windows Command Processor or Windows PowerShell, as appropriate, and check whether the process for your programming language contains (32-bit).
  3. Do one of the following:

    • To create a data source that only the user you’re currently logged in as can access, choose the User tab.
      If your application is a Windows service (for example, SQL Server or Oracle) creating a user data source won’t work, unless the service is running as the same user you’re logged in as.

    • To create a data source that all users on this computer can access, choose the System tab.

  4. Choose Add.

  5. In the list of ODBC drivers, select Easysoft ODBC-DB2 Driver, and then choose Finish.

  6. Complete the Easysoft ODBC-DB2 Driver configuration dialog box.
    To find out how to do this, refer to the Connection attributes section.

  7. To test the connection to Db2, choose Test.
    Note that this doesn’t test that the Easysoft ODBC-DB2 Driver is licensed. If you haven’t yet licensed the Easysoft ODBC-DB2 Driver, this ODBC data source won’t work with your application, even if the Test button succeeds.

Connection attributes

Setting on Linux and UNIX

Your Easysoft ODBC-DB2 Driver data source in odbc.ini must contain these attributes:

  • Server

  • Database

  • User

  • Password

For example:

[DB2_SAMPLE]
Driver          = Easysoft ODBC-DB2
Server          = localhost
Database        = sample
User            = db2admin
Password        = p455w0rd

These optional attributes may be set in odbc.ini.

  • AESEncAlg

  • CertificateFile

  • Client_LB

  • ConvWToUtf

  • Cypher

  • DPrec

  • Encrypt

  • Entropy

  • FPrec

  • GSSFlag

  • GSSLib

  • IPv6

  • Library

  • LimitVarchar

  • Locale

  • LogFile

  • Logging

  • NoXML

  • Override

  • Package

  • Port

  • PrivateKeyFile

  • RcvBuffer

  • SbUTF8

  • TrustServerCertificate

For more information about these attributes, refer to the following table and the table in the next topic.

Name Value

ClientLB

Whether the Easysoft ODBC-DB2 Driver tries to balance the load between the servers specified by the Server setting. The Client_LB setting only has an effect if you specify a primary server and additional fallback servers with Server.

When Client_LB is turned on (set to Yes), the Easysoft ODBC-DB2 Driver randomly selects a server to connect to. If the server is unavailable, the Easysoft ODBC-DB2 Driver then moves sequentially through the list of other servers.

When Client_LB is turned off (set to No, the default), the Easysoft ODBC-DB2 Driver tries to connect to the servers in the order that they are defined in. (Primary server first and then each additional fallback server.)

For example, you specify a primary server (myhostA) and two fallback servers (myhostB and myhostC):

Server = myhostA,myhostB,myhostC:1583

When Client_LB is turned on, the Easysoft ODBC-DB2 Driver will randomly choose a server to connect to. If, for example, the driver tries to connect to myhostB first, it will then try to connect to myhostC (if myhostB is unavailable) and myhostA (if myhostC is unavailable).

When Client_LB is turned off, the Easysoft driver will try to connect to myhostA and then myhostB (if myhostA is unavailable) and finally myhostC (if myhostB is unavailable).

ConvWToUtf

When turned on (set to Yes), the Easysoft ODBC-DB2 Driver converts strings passed to Unicode ODBC calls (with suffix "W") to UTF-8. The Easysoft ODBC-DB2 Driver also converts metadata and result sets returned by Unicode ODBC calls to UTF-8.

By default, ConvWToUtf is turned off.

DPrec

The precision to use when converting SQL_DOUBLE data in a result set to a string.

If an application specifies a string as the target type for non-character data in a SQLBindCol or SQLGetData call, the Easysoft ODBC-DB2 Driver converts the data to the target type. Use the DPrec attribute to specify the precision to use when the driver does this conversion for SQL_DOUBLE data.

The default precision is 7.

Entropy

The Easysoft ODBC-DB2 Driver needs a source of unpredictable data to work correctly. Many open source operating systems provide a "randomness device" (/dev/urandom or /dev/random) that serves this purpose. The Easysoft ODBC-DB2 Driver tries to use /dev/urandom by default and will also try to use /dev/random if /dev/urandom is not available.

If the driver is unable to find a suitable randomness device, it will return the error "SSL connection failed in syscall (errno=2, there may be no source of entropy on this system, consult OpenSSL documentation)."

On systems without /dev/urandom or /dev/random, the EGD entropy gathering daemon can be used as an alternative source of random data. It provides a socket interface through which entropy (randomness) can be gathered. Use the Entropy attribute to specify the path to the EGD socket. For example, if you create the socket in /etc when you start the EGD daemon (egd.pl /etc/entropy), use:

Entropy = /etc/entropy

FPrec

The precision to use when converting SQL_FLOAT data in a result set to a string

If your application specifies a string as the target type for non-character data in a SQLBindCol or SQLGetData call, the Easysoft ODBC-DB2 Driver converts the data to the target type. Use the FPrec attribute to specify the precision to use when the driver does this conversion for SQL_FLOAT data.

The default precision is 7.

GSSFlag

The Easysoft ODBC-DB2 Driver allows you to pass req_flags to the gss_init_sec_context() function, which is used to initiate a security context for the driver. The Key Distribution Center (KDC) uses this security context to verify the identity of the client. To pass req_flags to gss_init_sec_context(), use the GSSFLAG attribute:

GSSFLAG = req_flags

where req_flags is a bitmask specifying the requested GSS services. To look up the available bitmask values, refer to the gssapi.h header file for the GSS-API distribution on the Easysoft ODBC-DB2 Driver machine. The driver default GSSFLAG value is 4, which sets the GSS_C_REPLAY_FLAG flag.

As an example, to request credential delegation, set the GSS_C_DELEG_FLAG flag by including this entry in your data source GSSFLAG = 1.

GSSLib

The Easysoft ODBC-DB2 Driver uses libgssapi_krb5.so, the Kerberos GSS-API library, to request service tickets for accessing Db2 instances. If the Easysoft ODBC-DB2 Driver is unable to open this library, the connection will fail with the error:

Krb5: failed to open gss lib (libgssapi_krb5.so)

If the Kerberos GSS-API library is not called libgssapi_krb5.so in your GSS-API distribution, use the GSSLIB attribute in your data source to specify the alternative GSS-API library. For example:

GSSLIB = /opt/extension/lib/libgssapi.so

LimitVarchar

Use LimitVarchar to restrict the size returned by the Easysoft ODBC-DB2 Driver when describing VARCHAR data.

Locale

The locale on the Easysoft ODBC-DB2 Driver machine.

If you do not set the Locale attribute, the Easysoft ODBC-DB2 Driver will use the value set for the LC_CTYPE environment variable. If LC_CTYPE, is not set, the Easysoft ODBC-DB2 Driver uses the value set for the LANG environment variable. If neither LC_CTYPE nor LANG are set, the Easysoft ODBC-DB2 Driver sets the locale value to C.

NoXML

Turning on this attribute (setting it to Yes) prevents the Easysoft ODBC-DB2 Driver from asking the Db2 server for an XML Unicode manager. By default, NoXML is turned off (set to No).

Package

The Db2 package to connect to.

If you specify both database and package, the Easysoft ODBC-DB2 Driver attempts to connect to the package.

RcvBuffer

The size of the receive buffer for the socket in bytes. Possible values are:

0, do not set the receive buffer size, use the system default value.

n, where n is a number greater than 0, set the receive buffer to the specified size by passing n to the setsockopt() function .

By default, the system default receive buffer size is used.

SbUTF8

Controls how single bytes in a string are converted to Unicode. When turned on (set to Yes), UTF-8 sequences are regarded as single Unicode values. Otherwise, UTF-8 sequences are regarded as individual 8-bit values.

For example, setting SbUTF8 controls whether a UTF-8 Euro symbol (0xE2 0x82 0xAC) converts to 0x20AC (single character) or 0x00E2, 0x0082, 0x00AC (three characters).

By default, SbUTF8 is turned off (set to 0).

SingleDB

When turned on (set to Yes) the Easysoft ODBC-DB2 Driver doesn’t send the database name (the DDM_RDBNAM parameter) in the DRDA authentication message. By default, SingleDB is turned off (set to No).

Setting on Windows

The Easysoft ODBC-DB2 Driver data source configuration dialog box, accessible when you create or edit a Easysoft ODBC-DB2 Driver data source in ODBC Data Source Administrator contains these fields:

Name Value

DSN

The name of the data source. You’ll need to specify this in your application. For example, your application may prompt you to choose this from a list of DSNs.

Description

Some applications display this to help users identify a particular data source.

Database

The name of the Db2 database to connect to.

For example, to connect to the DB2 SAMPLE database set the Database attribute value to SAMPLE.

User Name

The Db2 user name, if required.

Password

The password for User Name.

Server

The host name or IP address of the machine on which the Db2 server is running.

Connection Failover

If your Db2 database is available on more than one Db2 machine, you can define a primary server for the database and additional fallback database servers. By default, the Easysoft ODBC-DB2 Driver will try to connect to the first server that you specify. If that server is unavailable, the Easysoft ODBC-DB2 Driver will try to connect to the next server in the list and so on. Use the format:

Server = primaryserver[:_port_] [, fallbackserver[:_port_]…​]

where:

  • primaryserver is the name or IP address of the primary Db2 machine on which your database is available.

  • port is the TCP port on which the instance is listening. If omitted, the driver will try to connect to the instance that’s listening on the default port for the database.

  • fallbackserver is the name or IP address of an alternative Db2 machine on which your database is available.

For example:

Server = myhostA,myhostB,myhostC:50001

Connection attempts continue until either a connection is successfully made or all the servers in the list have been tried once.

Note that authentication details (as specified by User and Password) needs to be valid on each Db2 machine in the list.

Port

The TCP port number that the Db2 server uses to listen for client connections.

If you’re connecting to a Db2 server that’s listening on the deafult port, 50000, the Port setting can be omitted

IPv6

Turn on this attribute when connecting to a Db2 server that’s listening on an IPv6 address.

By default, this attribute is turned off, which means that the Easysoft ODBC-DB2 Driver assumes that the target Db2 server is listening on an IPv4 address

SSL Encryption

Whether the Easysoft ODBC-DB2 requests an encrypted connection to Db2.

Use AES

The encryption algorithm to use when encrypting the user name and password. When turned on, the Easysoft ODBC-DB2 Driver encrypts the user name and password by using an Advanced Encryption Standard (AES) encryption algorithm. Otherwise, the Easysoft ODBC-DB2 Driver encrypts the user name and password by using a Data Encryption Standard (DES) encryption algorithm.

By default, Use AES is turned off.

Private Key File

The private key for the client certificate. Specify the full path. For example, c:\certs\clientkey.pem or /home/myuser/certs/clientkey.pem.

Certificate File

The .pem file containing the certificate for verifying the client. Specify the full path. For example, c:\certs\client.pem or /home/myuser/certs/client.pem.

The CA certificate file must be in base-64 PEM format. If the CA certificate is not installed on your client machine, you need to export the certificate on the Db2 computer and install it on the client computer.

Cypher

The cypher suite that the Easysoft ODBC-DB2 Driver will request during the SSL handshake with the Db2 machine.

A cypher suite is a set of authentication, encryption, and data integrity algorithms used to protect data exchanged between machines. During the SSL handshake part of the connection process, the SSL layer in the ODBC driver and the Schannel layer on the Db2 machine negotiate to decide which cipher suite they will use.

To find out which cypher suite is being used for a particular connection, enable Easysoft ODBC-DB2 Driver logging.

Connect and then examine the driver log file. Look for a log file entry similar to:

SSL using cypher 'RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5'

This entry shows that the ODBC driver and the Db2 machine negotiated the following cryptographic protection for the connection:

  • Encryption: RC4

  • Encryption strength: 128-bit

  • Cryptographic checksum: MD5

  • Authentication: RSA

(If your Db2 instance is running on Windows, You can also display the cryptographic settings negotiated during the SSL handshake by enabling Schannel logging. Enable the "Log informational and success events" Schannel logging option to write this information to the Windows Event Viewer logs.)

Use the Cypher setting, if you want to request a different encryption or data integrity algorithm to the ones negotiated during the SSL handshake. For example:

# Request Advanced Encryption Standard (AES) for data
# encryption. If AES is not available on the server,
# request 3DES.

Cypher = AES:3DES

If you specify a cypher suite that is not available on the server machine, the Easysoft ODBC-DB2 Driver returns the error "Required SSL (failed to receive packet)". If you specify a cypher suite that the Easysoft ODBC-DB2 Driver does not recognise, the driver returns the error "SSL3_CLIENT_HELLO:no ciphers available".

Trust Cert

Whether to bypass validation of the certificate used by the Db2 server. This setting is only applicable if you turn on SSL encryption for the Easysoft ODBC-DB2 Driver.

Logging

Whether to turn on Easysoft ODBC-DB2 Driver logging. Normally, you’ll only do this if so directed by the Easysoft support team.

Log File

The file name and path of the file you want the driver to write log information to. For example:

C:\Windows\Temp\Easysoft.log

If the file doesn’t exist, the Easysoft ODBC-DB2 Driver creates it.

Override

Override the default Easysoft ODBC-DB2 Driver behaviour for various actions. You should normally only have to specify a value for this option if directed to do so by Easysoft technical support.

DSN-less connections

Some applications allow you to make an ODBC connection without configuring a data source. To do this, you supply a connection string that contains the ODBC driver name and other driver-specific attribute-value pairs.

Here’s an example Easysoft ODBC-DB2 Driver connection string:

Driver={Easysoft ODBC-DB2 Driver};SERVER=localhost;UID=myuser;PWD=mypassword;DATABASE=SAMPLE;

For a list of the other attributes you can set in the connection string, refer to this section.

Logging

If you report an issue to us, we may ask you to turn on ODBC Driver Manager or Easysoft ODBC-DB2 Driver logging, to help us diagnose the cause of the issue.

To turn on logging, refer to the following sections.

If your application is a service (for example, Oracle or SQL Server), you may need to restart the service before enabling logging takes effect. To do this on Linux or UNIX, use service, systemctl, or a vendor-supplied script. To do this on Windows, use the Windows Services app.

ODBC Driver Manager logging on Linux or UNIX

For the unixODBC Driver Manager, add the following attributes to the [ODBC] section (create one if none exists) in odbcinst.ini.

Trace = Yes
TraceFile = /path/filename

For example:

[ODBC]
Trace = Yes
TraceFile = /tmp/sql.log

Ensure that the user who’s running the application to log has write permission to TraceFile (and to the directory containing it), otherwise no logging information will be produced.

Easysoft ODBC-DB2 Driver logging on Linux and UNIX

Driver manager trace files show all the ODBC calls an application makes, including their arguments and return values. Easysoft ODBC-DB2 Driver logging is specific to the Easysoft driver and is of most use when making a support call.

To turn on Easysoft ODBC-DB2 Driver logging, edit your ODBC data source in odbc.ini. For example:

The value shown in the example specifies a log file named /tmp/easysoft-odbc-driver.log. Ensure that the user who’s running the application to log has write permission to the log file (and to the directory containing it), otherwise no logging information will be produced.

ODBC Driver Manager logging on Windows

  1. In the Windows taskbar search box, enter “Run”.

  2. Do one of the following:

    • If your application is 64-bit, in the Run dialog box, enter:

      odbcad32.exe

      -Or-

    • If your application is 32-bit, in the Run dialog box, enter:

      %windir%\syswow64\odbcad32.exe
      If your not sure whether your application is 32-bit or 64-bit, start your application, then in Windows Task Manager check whether your application’s process name contains (32-bit). For example, the process name for the 32-bit version of Excel is Microsoft Excel (32-bit); the process name for the 64-bit version of Excel is Microsoft Excel. On older versions of Windows, 32-bit applications contain *32 in the process name rather than (32-bit).
      For applications such as Oracle or SQL Server that run as a service, check the *Background processes* list rather than the Apps list in Task Manager.
      If you’re running a programming language from within a Windows command-line shell (for example, Command or PowerShell), in your shell, run the .exe file for the programming language. For example, run perl, php, python, or node. In Task Manager, expand the process list for Windows Command Processor or Windows PowerShell, as appropriate, and check whether the process for your programming language contains (32-bit).
  3. Choose the Tracing tab.

  4. Select Machine-Wide tracing for all identities.

  5. Enter a log file name and path in the space provided. For example:

    C:\Windows\Temp\SQL.log
  6. Choose Start Tracing Now.

With SQL Server, you may get two Driver Manager log files, we need both. The first log file is in the folder that you specify in ODBC Data Source Administrator. The second file’s location is defined by SQL Server. Two possible locations are the top-level folder (for example, C:\SQL.log) or the SQL Server temporary folder (for example, C:\Users\MSSQL$SQLEXPRESS\AppData\Local\Temp\SQL.log). If the Driver Manager log file isn’t in these folders, search for it on the drive where SQL Server is installed.

Easysoft ODBC-DB2 Driver logging on Windows

  1. In the Windows taskbar search box, enter “Run”.

  2. Do one of the following:

    • If your application is 64-bit, in the Run dialog box, enter:

      odbcad32.exe

      -Or-

    • If your application is 32-bit, in the Run dialog box, enter:

      %windir%\syswow64\odbcad32.exe
      If your not sure whether your application is 32-bit or 64-bit, start your application, then in Windows Task Manager check whether your application’s process name contains (32-bit). For example, the process name for the 32-bit version of Excel is Microsoft Excel (32-bit); the process name for the 64-bit version of Excel is Microsoft Excel. On older versions of Windows, 32-bit applications contain *32 in the process name rather than (32-bit).
      For applications such as Oracle or SQL Server that run as a service, check the *Background processes* list rather than the Apps list in Task Manager.
      If you’re running a programming language from within a Windows command-line shell (for example, Command or PowerShell), in your shell, run the .exe file for the programming language. For example, run perl, php, python, or node. In Task Manager, expand the process list for Windows Command Processor or Windows PowerShell, as appropriate, and check whether the process for your programming language contains (32-bit).
  3. Do one of the following:

    • If you configured a system data source, choose the System DSN tab.
      -Or-

    • If you configured a system data source, choose the System DSN tab.

  4. Choose your Easysoft ODBC-DB2 Driver data source from the list, and then choose Configure.

  5. In the Easysoft ODBC-DB2 Driver data source configuration dialog box, turn on Driver Logging.

  6. Enter a log file name and path in the space provided. For example:

    C:\Windows\Temp\Easysoft.log

Finding out what product version you have on Windows

If you have an issue with the Easysoft ODBC-DB2 Driver, we may ask you to tell us what your product version is. To find this out:

  1. In the Windows taskbar, enter “Add or remove programs” in the Windows search box.

  2. Select Easysoft ODBC-DB2 Driver in the list.

    The product version displays below.