5. Verifying Client Libraries

For all of the databases that HammerDB supports it is necessary to have a 3rd party client library installed that HammerDB can use to connect and interact with the database. This client library will also be installed with database server software. The HammerDB command line tool can be used to check the status of library availability for all databases.


To run this utility run the following command

./hammerdbcli

and type librarycheck.

HammerDB CLI v3.0
Copyright (C) 2003-2018 Steve Shaw
Type "help" for a list of commands
The xml is well-formed, applying configuration
hammerdb>librarycheck
Checking database library for Oracle
Error: failed to load Oratcl - can't read "env(ORACLE_HOME)": no such variable
Ensure that Oracle client libraries are installed and the location in the LD_LIBRARY_PATH environment variable
Checking database library for MSSQLServer
Success ... loaded library tclodbc for MSSQLServer
Checking database library for Db2
Success ... loaded library db2tcl for Db2
Checking database library for MySQL
Success ... loaded library mysqltcl for MySQL
Checking database library for PostgreSQL
Success ... loaded library Pgtcl for PostgreSQL
Checking database library for Redis
Success ... loaded library redis for Redis

hammerdb

in the example it can be seen that the environment is not set for Oracle however all of the other libraries were found and correctly loaded. The following table illustrates the first level library that HammerDB requires however there may be additional dependencies. Refer to the Test Matrix to determine which database versions HammerDB was built against. On Linux the command ldd and on Windows the Dependency Walker Utility to determine additional dependencies. On Linux the LD_LIBRARY_PATH environment variable can be set to the location of installed libraries and PATH on Windows.

Table 1.3. 3rd party libraries

Database / OSLibrary
Oracle Linuxlibclntsh.so.
Oracle WindowsOCI.DLL
SQL Server Linuxlibodbc.so.
SQL Server WindowsODBC32.DLL
Db2 Linuxlibdb2.so.
Db2 WindowsDB2CLI64.DLL
MySQL Linuxlibmysqlclient.so
MySQL WindowsLIBMYSQL.DLL
PostgreSQL Linuxlibpq.so
PostgreSQL WindowsLIBPQ.DLL
RedisBuilt in library

5.1. Oracle Client

When using the Oracle instant client Oratcl uses the additional environment variable ORACLE_LIBRARY to identify the Oracle client library. On the Windows the Oracle client library is called oci.dll in a location such as: C:\oraclexe\app\oracle\product\11.2.0\server\bin On Linux the library is called libclntsh.so where this is typically a symbolic link to a product specific name such as libclntsh.so.12.1 for Oracle 12c. An example .bash_profile file is shown for a typical Oracle environment.

oracle@server1  oracle]$ cat ~/.bash_profile
# .bash_profile

if [ -t 0 ]; then
stty intr ^C
fi

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_LIBRARY=$ORACLE_HOME/lib/libclntsh.so
export ORACLE_SID=PROD1
export PATH=$ORACLE_HOME/bin:$PATH

5.2. SQL Server

On SQL Server on Windows the client libraries and necessary environment variables are set automatically during the SQL Server installation. Note that on 64-bit Windows the 64-bit ODBC client library is named ODBC32.DLL in the following location. C:\Windows\System32\odbc32.dll. On Linux follow the SQL Server on Linux installation guide to install 'mssql-tools' with the unixODBC developer package. The command database drivers will show the installed ODBC Driver.

hammerdb>database drivers
{{ODBC Driver 17 for SQL Server} {{Description=Microsoft ODBC Driver 17 for SQL Server} 
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-17.0.so.1.1 UsageCount=1}}

5.3. Db2

For DB2 on Linux the client library libdb2.so.1 is required either in the lib64 directory for 32. Similarly on Windows the db2cli64.dll is required. These libraries are included with a standard DB2 installation or also with a standalone DB2 client install.

5.4. MySQL

HammerDB version 3.0 has been built and tested against a MySQL 5.7 client installation. On Linux this means that HammerDB will require a MySQL client library called libmysqlclient.so.20. This client library needs to be referenced in the LD_LIBRARY_PATH in the same way described for Oracle previously in this section.

5.5. PostgreSQL

For PostgreSQL the client library is called libpq.dll on Windows and libpq.so on Linux however note that additional libraries are also required. For Windows this means setting your PATH environment variable such as the following: D:\PostgreSQL\pgsql\bin; On Linux it is required to set the LD_LIBRARY_PATH environment variable in the same way described for Oracle previously in this section to the location of the PostgreSQL lib directory. Alternatively for installations of EnterpriseDB the client directory also contains the necessary files for a HammerDB installation.

5.6. Redis

Redis The Redis client package is included with HammerDB for all installations and requires no further configuration.