Closed rockyrockstars closed 1 year ago
( possibly related: #755 )
At a command prompt, run
sudo find / -name libodbc.so
What does it show?
It is present in below locations.
/opt/teradata/client/16.20/lib/libodbc.so /opt/teradata/client/16.20/lib64/libodbc.so /opt/teradata/client/16.20/tbuild/odbc/lib/libodbc.so /opt/teradata/client/16.20/tbuild/odbc/lib64/libodbc.so /usr/lib/libodbc.so /usr/lib64/libodbc.so /opt/odbc32v53/lib/libodbc.so /opt/odbc32v53/lib_orig/libodbc.so
Okay, and what, if anything, does
echo $LD_LIBRARY_PATH
show you?
No... In library path they are not pointing to any of those libodbc directories
What about this?
ldconfig -p | grep libodbc.so
@gordthompson
/sbin/ldconfig -p | grep libodbc.so
Hmm, okay. You could do
strace -o /tmp/strace_out.txt python -c 'import pyodbc'
and then look at the "/tmp/strace_out.txt" file. Around line 770 (or so) you should see it search for libodbc.so, usually starting with several unsuccessful attempts ending with "(No such file or directory)", e.g.,
openat(AT_FDCWD, "/home/gord/PycharmProjects/pyodbc_demo/venv/lib/python3.8/site-packages/pyodbc.libs/tls/x86_64/x86_64/libodbc.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
and then finally finding one, e.g.,
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libodbc.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340q\0\0\0\0\0\0"..., 832) = 832
Which one does it find on your system?
It found as below. Remaining are -1
open("/usr/lib64/libodbc.so",O_RDONLY|O_CLOEXEC) = 3
Does
odbcinst -j
work for you? If so, what does it have to say?
It shows as below
Do you get any different behaviour if you use ansi=True
?
conx = pyodbc.connect(conn, ansi=True)
No..Its the same error
Unfortunately, I am running out of ideas. The only other thing that comes to mind is that an ODBC trace might offer some insight as to what is going on.
@gordthompson
It is looking for .odbc.ini and .odbcinst.ini in my home directory. But it didn't find it so it failed.
https://github.com/mkleehammer/pyodbc/issues/755#issuecomment-754201799 Can you suggest how this can be done?
It is looking for .odbc.ini and .odbcinst.ini in my home directory. But it didn't find it so it failed.
That is normal. If it doesn't find those files in your home directory it proceeds to look elsewhere.
#755 (comment) Can you suggest how this can be done?
I assume that they mean "rebuilding pyodbc from source". That would be something like
pip install --use-feature=no-binary-enable-wheel-cache --no-cache-dir --upgrade --force pyodbc --no-binary pyodbc
I want to run a sql statement using python module pyodbc in teradata.
I have teradata installed already then I installed pyodbc module using pip.
While executing pyodbc connect I am facing below issue UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 3: invalid start byte
Code:
import pyodbc
pyodbc.pooling=False
conn=r'DRIVER={DRIVER NAME};DBCNAME=DBC_NAME;AUTHENTICATION=KBR5;'
conx=pyodbc.connect(conn)
Traceback (most recent call last): File "load.py", line 7, in conx=pyodbc.connect(conn) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 3: invalid start byte