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 unixodbcHere's how to configure the c-tree ODBC driver and create and test a DSN on Linux.
-
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.
-
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
-
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]
-
Set the ODBCINI environment variable, e.g.
export ODBCINI=/etc/odbc.ini
-
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