Skip to Content

How can I setup an ODBC data source for c-treeRTG on Linux?

Estimated Reading Time: 1 Minutes

You can use a generic ODBC manager library to connect to c-treeRTG, similar to how it is done in Windows.
One of the most common is the unixODBC library.
This software may not be installed on your system. Use a command like this to install it:

   sudo apt install unixodbc
Here's how to configure the c-tree ODBC driver and create and test a DSN on Linux.
  1. Define the c-tree driver: edit the file /etc/odbcinst.ini, e.g.
        [ctreeDriver]
        Driver=/path/to/libctodbc.so
        Description=ODBC for c-treeRTG
        FileUsage=1
    
    Note - The libctodbc.so library is installed along with c-tree in the "drivers/ctree.drivers/lib" subfolder.
  2. Create a DSN bound to this driver: edit the file /etc/odbc.ini, e.g.
        Driver=ctreeDriver
        Host=localhost
        Database=ctreeSQL
        Service=6597
        Description=ctreeSQL data source
    
  3. To allow the unixODBC library to install the odbcinst and odcini you must execute the following commands:
        odbcinst -i -d -f /etc/odbcinst.ini
        odbcinst -i -s -l -f /etc/odbc.ini 
    
    You can test if your DSN is installed by executing:
        odbcinst -s -q
    
    Expected result: [ctreeDSN]

  4. Set the ODBCINI environment variable, e.g.
        export ODBCINI=/etc/odbc.ini
    
  5. Check that your unixODBC is configured for c-tree by running a tool connected to a unixODBC data source.
    For example, you can execute unixODBC's Interactive SQL (isql) from /usr/bin as shown below:
        isql -v ctreeDSN admin ADMIN
    
More information is given in the FairCom documentation here.
How can I setup an ODBC data source for c-treeRTG on Linux?