In the following sections, you can find how-tos on installing the unixODBC driver manager, setting up the driver for unixODBC, and creating DSNs.
Precompiled binaries for the unixODBC driver manager are available for many operating systems.
On Debian-based systems like Ubuntu, you can install unixODBC by running the
following command as root or with sudo:
apt-get install unixodbc unixodbc-devOn Red Hat Enterprise Linux, CentOS, and Fedora, you can install unixODBC with YUM or DNF. For example, run the following command as root or with sudo:
yum install unixODBC unixODBC-develIf binaries are not available for your operating system, you will need to compile unixODBC yourself. Please refer to the unixODBC website for more information about obtaining binaries or compiling unixODBC on your operating system.
Using unixODBC Configuration Files
If your unixODBC installation does not include a graphical tool, you can set up connectivity to HPCC by editing the configuration files.
You can determine the location of the configuration files on your system by entering the following command into a terminal:
odbcinst -jBelow is an example of the output of this command:
DRIVERS............: /etc/odbcinst.ini SYSTEM DATA SOURCES: /etc/odbc.ini FILE DATA SOURCES..: /etc/ODBCDataSources USER DATA SOURCES..: /home/myuser/.odbc.ini SQLULEN Size.......: 8 SQLLEN Size........: 8 SQLSETPOSIROW Size.: 8Note: Modifying system-wide settings requires elevated permissions; to do so, you can use root or the sudo command.
Set the Driver Encoding
unixODBC communicates with applications using UTF-16 encoding. This is the default encoding in CData ODBC drivers, but this can be set to alternative options if necessary, in the config file '/opt/cdata/cdata-odbc-driver-for-hpcc/lib/cdata.odbc.hpcc.ini'.
Register the Driver
Register the driver by adding a section to the odbcinst.ini file. You may need to modify the installed driver definition if you change the path to the driver library.
The sections of the odbcinst.ini file map a driver name to the driver library. The section begins with the driver name; the Driver property points to the path to the driver library. The driver library is the .so file located by default in /opt/cdata/cdata-odbc-driver-for-hpcc/lib. A Description property can also be provided.
[CData ODBC Driver for HPCC] Driver=/opt/cdata/cdata-odbc-driver-for-hpcc/lib/libhpccodbc.x64.so Description=CData ODBC Driver for HPCC
To check that the driver is registered, list the drivers installed on the system with the following command:
odbcinst -q -d
Define a DSN
Create a DSN by adding an entry to odbc.ini. Below is an example DSN entry in odbc.ini:
[CData HPCC Source] Driver=/opt/cdata/cdata-odbc-driver-for-hpcc/lib/libhpccodbc.x64.so URL=http://127.0.0.1:8510 User=test password=xA123456 Version=1 Cluster=hthor
Test the Connection
You can use the unixODBC test tool, isql, to execute SQL queries to HPCC from the command line. When testing the connection, use the -v flag to output any messages from the driver manager and the driver.
isql -v "CData HPCC Source"