问题
I have deployed the django project on ubuntu 20.04, nginx , gunicron. A part of the code is not able to run on the server it gives error
('01000', "[01000] [unixODBC][Driver Manager]Can't open lib
'/opt/netsuite/odbcclient/lib64/ivoa27.so' : file not found (0) (SQLDriverConnect)")
While the file is available :-
xxxx@XXXXXX:/opt/netsuite/odbcclient/lib64$ ls
ddtrc27.so ivmgan27.so ivmghu27.so ivoa27.so libicudata.so.42 libivoa27m.so
libodbc.so openssl810.so
ivldap27.so ivmgapi27.so ivoa27.ini libddicu27.so libicuuc.so.42 libodbcinst.so
odbccurs.so
It is working fine in the local server. And even in the Server terminal. But it gives error after starting nginx, gunicron service on the domain url. Everything else is working fine. Below output is from the server terminal
```xxxxx@xxxxcc:~$ python3
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyodbc
>>> host = 'xxxxx'
>>> uid = "xxxxx"
>>> role_id = 'xxxxx'
>>> pwd = "xxxxx"
>>> account_id = "xxxxx"
>>> pyodbc.connect('DRIVER={NetSuite};Host='+host+';Port=1708;Encrypted=1;Truststore=/opt/netsuite/odbcclient/cert/ca3.cer;SDSN=NetSuite.com;UID='+uid+';PWD='+pwd+';CustomProperties=AccountID='+account_id+';RoleID='+role_id+'')
<pyodbc.Connection object at 0x7f920414e2d0>
>>>
```
The same code has been used inside the django project and it gives error when checking on domain(URL) after starting the nginx, gunicorn services.
I have tried checking the available drivers using ```odbcinst -j`` the driver is available. Given +777 permission to the directory and all inner files in the /opt/netsuite/. Creating symlinks, exported paths to .bash_proifile, .bash_rc, /etc/environment. I did whatever I could find on the internet, but still I am not able to solve the issue.
Output of odbcinst -j:-
```xxxxxx@xxxxxx:~$ odbcinst -j
unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /opt/netsuite/odbcclient/odbc64.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
```
I found some thread which stated that ubuntu 20.04 has removed /etc/securetty, which may cause PAM failures on SSH/FTP. Ubuntu 20.04 doesn't have /etc/securetty file as I checked.
This is the output of env:-
```SHELL=/bin/bash
PWD=XXXXXXX
LOGNAME=xxxxx
XDG_SESSION_TYPE=tty
MOTD_SHOWN=pam
HOME=/home/xxxxxx
LANG=en_US.UTF-8
OASDK_ODBC_HOME=/opt/netsuite/odbcclient/lib64
SSH_CONNECTION=XXXXXXXXXXXX
ODBCINI=/opt/netsuite/odbcclient/odbc64.ini
XDG_SESSION_CLASS=user
TERM=xterm-256color
USER=xxxxxx
SHLVL=1
XDG_SESSION_ID=7
LD_LIBRARY_PATH=/opt/netsuite/odbcclient/lib64:/opt/netsuite/odbcclient/lib64
XDG_RUNTIME_DIR=/run/user/1000
SSH_CLIENT=XXXXXXXXXXXX
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/mssql-tools/bin:/opt/netsuite/odbcclient/lib64/:/opt/mssql-tools/bin:/opt/netsuite/odbcclient/lib64/
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
SSH_TTY=/dev/pts/3
_=/usr/bin/env
```
I also have Mysql ODBC which is working fine.
来源:https://stackoverflow.com/questions/65262320/cant-open-lib-opt-netsuite-odbcclient-lib64-ivoa27-so-unable-to-find-odbc-dri