0

I am trying to connect to an existing Sybase Advantage Database Server via the ODBC driver on a LOCAL instance. I currently have unixodbc, unixodbc-dev, and unixodbc-bin installed.

When I attempt the following:

import pyodbc
str='DRIVER={Advantage ODBC Driver};DataDirectory=/var/lib/advantage/.../dbfile.add;User ID=...;Password=...;ServerTypes=1;'
connection = pyodbc.connect(str)

I get the following error:

pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')

Here's my /etc/odbc.ini (and /etc/odbcinst.ini) file:

;
; odbc.ini
;
[ODBC Data Sources]
Odie = Advantage ODBC Driver

[Odie]
Driver=/opt/ads/odbc/redistribute/libadsodbc.so.11.10.0.24
DataDirectory=/var/lib/advantage/.../dbfile.add
Description=Advantage ODBC driver
Rows=False
MemoBlockSize=64
DefaultType=Advantage
MaxTableCloseCache=0
LOCKING=Record
CharSet=OEM
ADVANTAGELOCKING=OFF
ServerTypes=1
TableExtension=

I see three potential issues here - either my connection string is wrong, my odbc.ini file is incorrectly setup, or my unixodbc hasn't reloaded the odbc.ini since I modified it (if there is such a thing). I have attempted the solution proposed here, without avail.

Thanks for your help!

Community
  • 1
  • 1
Philippe Hebert
  • 1,616
  • 2
  • 24
  • 51
  • 1
    Disclaimer: I'm not familiar with Advantage. Have you tried debugging your connection with the command line tool `isql`? Try connecting with `isql` verbose: `isql -v dsn username password`, and have a look at the log. – FlipperPA Apr 23 '16 at 00:38
  • @FlipperPa: I didn't know of this utility. After fiddling around I specifed "Odie" as the DSN. The error returned changed from above, returning the following: `[01000][unixODBC][Driver Manager]Can't open lib '/opt/ads/odbc/redistribute/libadsodbc.so.11.10.0.24` I attempted the same with sudo, but no change. I checked for permission problems; all parent folders have permissions of rwxr-xr-x and the said file has rwxr-xr--. I also attempted to see if the path wasn't good by doing a `if [ -f path ]`, and _without_ sudo it returned true. :scratch-my-head: – Philippe Hebert Apr 23 '16 at 01:45
  • Maybe try copying `libadsodbc.so.11.10.0.24` to `/`, 777'ing it, and changing the config to point to the file in `/`? Then you could verify whether or not it is a permissions issue, and move the file down the folder tree one step at a time. Ugly, but debugging normally is! :) – FlipperPA Apr 23 '16 at 02:45
  • No luck; same error message at root level after chmod 777'ing it. `user@computer:/$ ls -la` yielded the following entry: `-rwxrwxrwx 1 root root 338030 Apr 23 08:59 libadsodbc.so.11.10.0.24` – Philippe Hebert Apr 23 '16 at 13:04
  • That may be symptomatic, then. Can we try `ldd /opt/ads/odbc/redistribute/libadsodbc.so.11.10.0.24` to see if any of the dependencies of the library are missing? – FlipperPA Apr 23 '16 at 23:17
  • All dependencies are found - `linux-gate.so.1 => (0xf7713000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf74f9000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf74dd000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf74d7000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7491000) libace.so.11.10 => /usr/lib32/libace.so.11.10 (0xf72d7000) /lib/ld-linux.so.2 (0xf7716000)` – Philippe Hebert Apr 24 '16 at 00:15
  • For me this Problem was solved when I used the x64 version of adsodbc driver. – Abenil Dec 06 '18 at 16:19

0 Answers0