How to Find List of Odbc Drivers Installed on Linux

How to find list of ODBC drivers installed on Linux

Thanks for the answers but I found out that list of installed ODBC drivers on Linux can be found on

/etc/odbcinst.ini and /home/{userName}/.odbcinst.ini which is very similar to macOS

How can I determine what drivers are available to use with odbc in php (on a linux system)?

You should have a file called odbcinst.ini (probably in /etc or /usr/local/etc but you can locate it with the command odbcinst -j). This file defines your ODBC drivers. Each driver is named within the [] in each section.

You might find Linux ODBC useful as it contains a thorough explanation of unixODBC, how it works and how to define data sources.

How to grab Postgres ODBC Driver version installed in a Linux Server?

It seems like the only way is to write a C program that calls the SQLGetInfo function with SQL_DRIVER_VER as InfoType.

Here is a minimal program that works for me:

#include <sql.h>
#include <sqlext.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char **argv)
{
SQLHENV henv;
SQLHDBC hdbc;
char version[25];
SQLSMALLINT version_size;

(void) SQLAllocHandle(SQL_HANDLE_ENV,
SQL_NULL_HANDLE,
&henv);

(void) SQLSetEnvAttr(henv,
SQL_ATTR_ODBC_VERSION,
(SQLPOINTER)SQL_OV_ODBC3,
0);

(void) SQLAllocHandle(SQL_HANDLE_DBC,
henv,
&hdbc);

(void) SQLGetInfo(hdbc,
SQL_DRIVER_VER,
&version,
25,
&version_size);

write(1, version, strlen(version));
write(1, "\n", 1);

return 0;
}

Here is how I build and run it:

> gcc -Wall -o odbcversion -Wl,-rpath,/usr/pgsql-14/lib odbcversion.c /usr/pgsql-14/lib/psqlodbc.so
> ./odbcversion
13.02.0000

R odbc::odbcListDrivers() does not list dirver in /opt/homebrew/etc/odbcinst.ini

With M1 Mac I was able to connect to SQL Server through terminal by changing the openssl folder to an older version. The driver installs openssl@3 (opt/homebrew/opt/openssl@3) but you actually need to use openssl@1.1 instead.

Here are the steps i followed in terminal:

brew install openssl@1.1
rm /opt/homebrew/opt/openssl
ln -s /opt/homebrew/Cellar/openssl@1.1/1.1.1l_1 /opt/homebrew/opt/openssl

This will create a symlink "openssl" and point it to the correct file (1.1.1l_1) inside the opt/homebrew/Cellar/openssl@1.1 folder.
Before creating the symlink verify the file name 1.1.1l_1 has not changed with a newer version in opt/homebrew/Cellar/openssl@1.1/1.1.1l_1

Specify odbc driver manager on Linux

LD_LIBRARY_PATH must include both the directory holding the ODBC driver and the ODBC driver manager.

So, you must locate the ODBC Driver Manager on your Linux machine, typically either iODBC or UnixODBC. You should be able to find these libraries with a command like

find / -name 'lib*odbc*.so*' -print 

You'll need to add that directory as well as /opt/simba/athenaodbc to your LD_LIBRARY_PATH, with a command like --

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/simba/athenaodbc:/path/to/dir/containing/lib*odbc*.so*

Note 1 -- /path/to/dir/containing/lib*odbc*.so* is a placeholder in the command above. You must change this to the correct local directory, probably something like /usr/lib or /lib.

*Note 2 -- this is adding the two new directories to any existing LD_LIBRARY_PATH value, not setting LD_LIBRARY_PATH to only those two directories.*



Related Topics



Leave a reply



Submit