Differences

This shows you the differences between two versions of the page.

sqldata_db2_connection [January 10, 2018 3:28 am]
sqlines
sqldata_db2_connection [November 27, 2020 7:24 am] (current)
sqlines
Line 18: Line 18:
    * For example, at (Drive letter can be different):     * For example, at (Drive letter can be different):
    * //C:\Program Files\IBM\SQLLIB\BIN//     * //C:\Program Files\IBM\SQLLIB\BIN//
 +
 +===== Installing DB2 Data Server Driver Package on Linux =====
 +
 +Download the driver package from IBM web site, for example //ibm_data_server_driver_package_linuxx64_v11.1.tar.gz//
 +
 +Unzip the file:
 +
 +<code>
 +  tar -zxvf ibm_data_server_driver_package_linuxx64_v11.1.tar.gz
 +</code>
 +
 +Run the installation script:
 +
 +<code sql>
 +  cd dsdriver
 +  
 +  # it uses #! /bin/ksh -p, so specify bash explicitly if ksh is not available
 +  bash ./installDSDriver
 +</code>
===== Configuring DB2 Connection on Linux ===== ===== Configuring DB2 Connection on Linux =====
-Before running //sqldata// command, add the DB2 library location to //LD_LIBRARY_PATH//:+Before running //sqldata// command import definitions from the //db2profile// script if you use DB2 Data Server Driver Package: 
 + 
 +<code sql> 
 +  . db2profile 
 +</code> 
 + 
 +Or add the DB2 library location to //LD_LIBRARY_PATH//:
<code>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<db2_client_lib></code> <code>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<db2_client_lib></code>
Line 28: Line 53:
<code>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ibm/db2/V11.1/lib64</code> <code>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ibm/db2/V11.1/lib64</code>
 +
 +If using DB2 Data Server Driver Package, you can add a new data source as in the following example:
 +
 +<code sql>
 +  db2cli writecfg add -dsn sample -database SAMPLE -host 10.0.2.2 -port 50000
 +</code>
 +
 +Or create //<db2_driver_dir>/dsdriver/cfg/db2dsdriver.cfg// configuration file manually, for example:
 +
 +<code xml>
 +<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
 +<configuration>
 +  <dsncollection>
 +    <dsn alias="sample" host="10.0.2.2" name="SAMPLE" port="50000"/>
 +  </dsncollection>
 +
 +  <databases>
 +    <database host="10.0.2.2" name="SAMPLE" port="50000"/>
 +  </databases>
 +
 +</configuration>
 +</code>
 +
 +Then you are ready to use the DB2 connection in ./sqldata command, for example:
 +
 +<code>
 +  ./sqldata -sd=db2,user/pwd@sample -t=sales ...
 +</code>
===== Troubleshooting DB2 Connection on Linux ===== ===== Troubleshooting DB2 Connection on Linux =====
-If you get "Error allocating environment handle" error during connection to IBM DB on Linux host due to lack of permissions. Try ti run //./sqldata tool// under //sudo su - db2inst// or other appropriate user from DB2ADMIN group.  +If you get "Error allocating environment handle" error during connection to IBM DB on Linux host due to lack of permissions. Try to run //./sqldata tool// under //sudo su - db2inst// or other appropriate user from DB2ADMIN group.