unixODBC Amazon Redshift issue (Can't open lib '/opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so' : file not found)
Asked Answered
E

1

6

I am trying to set up unixODBC to access Amazon Redshift and I keep getting this error, I have triple checked my setup but not sure what the issue is

> isql -v mlaws
[01000][unixODBC][Driver Manager]Can't open lib '/opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so' : file not found
[ISQL]ERROR: Could not SQLConnect

Below are my .odbc.ini and odbcinst.ini files and details

my current odbcinst -j setting is,

unixODBC 2.3.4
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/fuxi/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

my odbcinst.ini file has the appropriate Redshift Driver,

[PostgreSQL ANSI]
Description=PostgreSQL ODBC driver (ANSI version)
Driver=psqlodbca.so
Setup=libodbcpsqlS.so
Debug=0
CommLog=1
UsageCount=1

[PostgreSQL Unicode]
Description=PostgreSQL ODBC driver (Unicode version)
Driver=psqlodbcw.so
Setup=libodbcpsqlS.so
Debug=0
CommLog=1
UsageCount=1

[Amazon Redshift (x64)]
Description=Amazon Redshift ODBC Driver(64-bit)
Driver=/opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so

I have verified the driver location.

My .odbc.inc is,

[personal]
Driver      = PostgreSQL Unicode
ServerName  = ---.---.---.---
Port        = 5432
Database    = db1
Username    = uuuuuu
Password    = xxxxxx
Debug       = 1


[mlaws]
Driver      = Amazon Redshift (x64)
ServerName  = <link>
Port        = 5439
Database    = db
Username    = uuuuuu
Password    = xxxxxx

I have copied my amazon.redshiftodbc.ini file to /etc/ and added the following to it

[Driver]
## - DriverManagerEncoding is detected automatically.
##   Add DriverManagerEncoding entry if there is a need to specify.
DriverManagerEncoding = UTF-16
ErrorMessagesPath=/opt/amazon/redshiftodbc/ErrorMessages
LogLevel=0
LogPath=[LogPath]
SwapFilePath=/tmp
ODBCInstLib=/usr/lib/x86_64-linux-gnu/libodbcinst.so.1

Here are my current environment variables

export ODBCINI=~/.odbc.ini
export ODBCSYSINI=/etc
export AMAZONREDSHIFTODBCINI=/etc/amazon.redshiftodbc.ini

I am not really sure what I am doing wrong at this point. ibamazonredshiftodbc64.so exist where its suppose to, but unixODBC just can't seem to find it

Excite answered 29/9, 2020 at 22:48 Comment(3)
Are you still having this problem? Mine looks VERY similar to yours.Gorky
Bounty doesnt appear to be working. I switched over to using Npgsql driver instead. No ini files to worry about.Gorky
The issue is that alpine does not use Glibc and masl for its c++ math libraries and those are required for unixODBC. You CAN install those libraries, just be sure, that if you installed unixODBC with NPM, you ALSO install glibc and all ITS dependencies with NPM also. Otherwise they wont be able to see each other and you get the file not found error..Gorky
E
1

It worked for me:

cp /etc/odbc.ini ~/.odbc.ini
cp /etc/odbcinst.ini ~/.odbcinst.ini

echo 'export ODBCINI=~/odbc.ini' >> ~/.bashrc
echo 'export ODBCSYSINI=~/directory' >> ~/.bashrc
source ~/.bashrc

And then you should be able to see the driver name by running:

odbcinst -q -d
Erland answered 7/3 at 18:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.