Hi, I am using Raspberry PI 3 Model B and have installed SQL Anywhere 17 on it. I am following SCN blogs which showed how to install SQL Anywhere and also connect to it via a Python program. http://scn.sap.com/community/sql-anywhere/blog/2014/08/11/sql-anywhere-available-for-linux-on-arm When I execute my python program, I get an error "Could not load dbcapi". After installing SQL Anywhere, I used the below commands to set the PATH and create a new DB.
I installed PIP and sqlanydb libraries using below commands
I copied the sample code to test the python script. I already have pythoin 2.7.9 installed on my Raspberry PI.
Below are some information on my Path settings and System OS info.
NODE_PATH=/home/pi/MySql/node:
However, I was able to use the terminal to connect to the newly created DB using the following commands.
I started the demo DB and tried to use python script to connect to it. It gave me the same error message. Below is the complete error message.
Thanks, Murali asked 26 May '16, 07:41 Murali |
Ah, yes! SUDO does not export the LD_LIBRARY_PATH environ or other environs unless included on the cmdline ..... You might be able to run it as sudo LD_LIBRARY_PATH=home/pi/MySql/lib32 python MySQL01.py or possibly sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} python MySQL01.py You can break SUDO security model http://serverfault.com/questions/371630/how-to-configure-sudoers-to-always-keep-ld-library-path-envrionment-variable but that wouled be unadviseable. answered 26 May '16, 15:36 Nick Elson S... Thanks Nick. I will test it out. Cheers.
(27 May '16, 02:06)
Murali
|
The fact that you are getting this error tends to confirm the Python 'driver' is installed, set up correctly, and is loading correctly. The next thing to verify is if your installation has the library libdbcapi_r.so installed. And, if it does, verify the location of that is set in your LD_LIBRARY_PATH; this is usually set up for you when you run the sa_config.sh or sa_config.csh which is a required step. answered 26 May '16, 09:27 Nick Elson S... Thanks Nick. I can verify the existence of the file libdbcapi_r.so inside the lib32 folder. I sourced the file sa_config.sh. Hence below is my path which has the LD_LIBRARY_PATH set to the lib32 folder
(26 May '16, 13:19)
Murali
I found the problem. I was running the python program using SUDO command in the front. It seemed to have a problem. If I type in the command "python MySQL01.py" it works fine. I generally use sudo command when my python program access GPIO pins in my raspberry pi. Thanks, Murali
(26 May '16, 13:46)
Murali
|
Hi Guys, I have something similar to this issue If I run a program inside a virtualenv, everything works fine. Now, I want to debug my code with Paycharm(with pydev debugger) and got this error -> InterfaceError: (u'Could not load dbcapi. Tried: None,dbcapi.dll,libdbcapi_r.so,libdbcapi_r.dylib', 0) after seeing the code of sqlanydb I found this variable SQLANY_API_DLL and set to /opt/sqlanywhere17/lib64/libdbcapi_r.so I got this error now -> InterfaceError: ('Failed to initalize dbcapi context, dbcapi version 2 required. Perhaps you are missing some sqlanywhere libaries?', 0) Any help/ideas? answered 13 Mar '18, 09:09 miknotauro2 |