Thursday, July 25, 2013

cannot open shared object file: No such file or directory

This is very generic error and you will see this error with many situations.

I have received this error when connecting to Mysql using isql

$ isql -v MySQL test_user testpass
[01000][unixODBC][Driver Manager]Can't open lib '/usr/lib/libmyodbc.so' : /usr/lib/libmyodbc.so: cannot open shared object file: No such file or directory
[ISQL]ERROR: Could not SQLConnect 


Cause: The Mysql cannot find the required library

Possible Solution: Locate the file libmyodbc.so, if you don’t find the file then you might be using a different version. Find the lib file that you are using ‘libmyodbc*’ and create a link.

     For ex:- ln –s <Path to file> < Link Name>
     $ ln –s /home/mysql/lib/libmyodbc3-3.51.07.so /usr/lib/libmyodbc.so

In many causes users will see this error, if they don’t include the library path in LD_LIBRARY_PATH

Users might receive below error, when connecting using “odbcinst”. This is also one of the common error.

$ odbcinst –q -s
odbcinst: SQLGetPrivateProfileString failed with . 


Cause: The environment variables are not set properly

Solution: For Linux, edit .bash_profile and add following environment variables 

export ODBCSYSINI=/etc
export ODBCINI=/etc/odbc.ini

In caseof CSH,

setenv ODBCSYSINI /etc
setenv ODBCINI /etc/odbc.ini

Reference:

Configure a Connector/ODBC DNS on Unix
Problems with connecting other platforms to MySQL with ODBC
Download MySQL Connector/ODBC

Regards
Satishbabu Gunukula, Oracle ACE
http://www.oracleracexpert.com

No comments:

Post a Comment