on 04-22-2016 10:30 PM
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!
(Please note this is a duplicate from http://stackoverflow.com/questions/36803560/pyodbc-connection-with-advantage-odbc-driver-linux)
Shouldn't you use the ODBC driver alias instead of the description?
<pre>
str='DRIVER=Odie; ...
</pre>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have attempted it without any avail. However the contributor on the sister question on SO gave some interesting insight which confirmed your point - using "Odie" as the driver name does make a change, but the root of the problem seems to be deeper.
Using unixodbc's isql utility (sudo isql -v "Odie" UID PID) to verify the odbc driver, I get the following error message :
[01000][unixODBC][Driver Manager]Can't open lib '/opt/ads/odbc/redistribute/libadsodbc.so.11.10.0.24
Following this error message, I attempted to see if the problem was a permission problem. As such, I checked for permission problems; all parent folders have permissions of rwxr-xr-x and the said file has rwxr-xr--. Being created by the root account, sudo-ing the command should allow for execution of the file.
Following the recommendation of the contributor, I attempted changing the permissions of the file to 777 and moving it to the root, to no avail.
Later on, we attempted ldd /opt/ads/odbc/redistribute/libadsodbc.so.11.10.0.24 to see if any dependencies were missing - all dependencies turned up fine.
Would you have any idea how to proceed further?
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.