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!

7
  • 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, 2016 at 0: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: Apr 23, 2016 at 1: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, 2016 at 2: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 Apr 23, 2016 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, 2016 at 23:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.