In this tutorial I will be configuring Oracle ODBC driver on CentOS/Redhat server and go true typical issues you might face and also explain how you can fix it.
I have Oracle database 11g running on the same Redhat server, if your database is running on a different server then you need to download and install Oracle Instant Client from Oracle web website and follow installation procedure.
If you have Oracle installed on the same CentOS/Redhat server then you can follow my steps in this guide.
You can apply the same troubleshooting steps for both scenarios.
Here are the steps.
- Configure Oracle ODBC Driver (odbcinst.ini)
- Configure Oracle ODBC Datasource (odbc.ini)
- Testing ODBC connection
- Troubleshooting error (Can’t open lib : file not found)
1 Configure Oracle ODBC Driver (odbcinst.ini)
First we need to find where is Oracle ODBC shared library file is located.
Now we can open /etc/odbcinst.ini file and configure ODBC driver.
2 Configure Oracle ODBC Datasource (odbc.ini)
Open ODBC Datasources file /etc/odbc.ini and put your database information
3 Testing ODBC connection
You can test if all dependencies are installed using dltest command and verify connection using isql command
4 Troubleshooting error (Can’t open lib : file not found)
If you get an error [unixODBC][Driver Manager]Can’t open lib ‘/u01/app/oracle/product/11.2.0/dbhome_1/lib/libsqora.so.11.1’ : file not found is because missing symbolic link and is a know Red Hat issue.
You can check if all dependencies are installed and working using ldd command
From the screenshot above we can see an error libodbcinst.so.1 => not found.
Now we need to locate libodbcinst and create symbolic link.
Retest everything again and it should work as expected.