waliwali / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

ibm_db with Apache and mod_wsgi on Windows - ImportError DLL load failed #112

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi
I have an issue running Django application that use ibm_db to connect with db2 
database.
I have a virtualenv with installed django 1.4 and ibm_db egg package 
(precompiled).

If I run django app from runserver command (python manage.py runserver) I have 
no errors, but if I run with Apache and mod_wsgi, naturally configured to work 
with virtualenv, following error occurs:

ImportError at /
DLL load failed

and the line is:
import ibm_db 

with python shell and runserver all works fine

What version of the product are you using? On what operating system?
windows server 2008 r2
ibm_db-1.0.5-py2.7-win32.egg (precompiled, installed with easy_install)

Please provide any additional information below.
Windows server 2008 r2
apache 2.2 windows 32 bit
python 2.7.3
mod_wsgi/3.3

What's wrong?

Thanks
MI

Original issue reported on code.google.com by marcoi...@gmail.com on 14 May 2012 at 4:13

GoogleCodeExporter commented 9 years ago
See http://code.google.com/p/ibm-db/issues/detail?id=113 for better diagnostic 
of the error. 

I had similar issue, and the cause was that ibm_db_django needs ibm_db.pyd 
(what can be seen in apache error log), and pyd couldn't be loaded in apache 
process - *n*x version because some db2 dll/.so was not in the path:

   libdb2.so.1: cannot open shared object file: No such file or directory

Solution: setup path (win) or LD_LIBRARY_PATH on *n*x systems for apache 
process on process start. 

Reference: 
http://code.google.com/p/modwsgi/wiki/InstallationIssues#Unable_To_Find_Python_S
hared_Library

Original comment by trebor74hr@gmail.com on 14 May 2012 at 8:22

GoogleCodeExporter commented 9 years ago
Hi, thanks for reply.

I use only ibm_db module (not ibm_db_django) to perform raw sql queries.

I try to get further information from exception doing

try:
   import ibm_db
except Exception, e:
   print e

and I have
DLL load failed: specified module not found

without missing dll name information 

following PATH information set on windows environ

C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\PROGRA~1\IBM\SQLLIB\BIN;
C:\PROGRA~1\IBM\SQLLIB\FUNCTION;
C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;
c:\python27;
c:\python27\Scripts;
C:\PROGRA~1\IBM\SQLLIB\clidriver\bin;
C:\VEnvs\services\Scripts;
C:\Program Files\IBM\SQLLIB\lib;
C:\Program Files\IBM\SQLLIB\lib\Win32

Thanks for help

Original comment by marcoi...@gmail.com on 15 May 2012 at 9:58

GoogleCodeExporter commented 9 years ago
Django will not communicate directly with ibm_db, so please cross check for 
ibm_db_django. 

Please check your settings.py file and let us know what you have given in 
'ENGINE' name.

Original comment by rahul.pr...@in.ibm.com on 15 May 2012 at 10:19

GoogleCodeExporter commented 9 years ago
Thanks for reply.

I don't understand why I need ibm_db_django.

Just for explain what i'm doing:

we need to perform raw sql queries to db2 database from a django application 
used as webservice app.

we have no models defined into application

we perform only following type of statements:

conn=ibm_db.connect(...,...,...)
stmt = ibm_db.prepare(conn, sql)
ibm_db.bind_param(stmt, 1, param)
ibm_db.execute(stmt)
...

with runserver all works properly but with apache/mod_wsgi not.

Thanks

Original comment by marcoi...@gmail.com on 15 May 2012 at 11:18

GoogleCodeExporter commented 9 years ago
You are getting the above errors due to apache didn't able to find either 
ibm_db.pyd or db2cli.dll file. 

Please set the PATH variable in 'envvars' with 'C:\PROGRA~1\IBM\SQLLIB\BIN', 
'c:\python27', and c:\python27\Scripts .

please let us know it works for you or not.

Original comment by rahul.pr...@in.ibm.com on 16 May 2012 at 12:13

GoogleCodeExporter commented 9 years ago
Hi

sorry for late.

Maybe the cause of the issue was that server had 64 bit architecture. Now I 
have configured a windows 32 bit server with .NET framework 3.5 (I don't know 
if is a requirements) and now work, without settings apache 'envvars' but only 
setting PATH system variable.

Thanks

MI

Original comment by marcoi...@gmail.com on 19 Jun 2012 at 2:35

GoogleCodeExporter commented 9 years ago
Hello,
Please help! 

I have ubuntu 12.04 64-bit (similar to your old configurations), and I am 
unable to install ibm_db or ibm_db_django using easy_install. I managed to make 
it work on windows, but on linux I get the error:

Environment variable IBM_DB_HOME is not set. Set it to your 
DB2/IBM_Data_Server_Driver installation directory and retry ibm_db module 
install.

Can you provide any feedback about that or how to fix this problem?

Thanks a lot!

Original comment by narmer1...@gmail.com on 25 Aug 2012 at 8:24

GoogleCodeExporter commented 9 years ago
Please set you IBM_DB_HOME environment variable to "/path/to/sqllib" or If you 
are using IBM_Data_Server_Driver client then set it to DS Driver intallation 
directory.

Original comment by rahul.pr...@in.ibm.com on 26 Aug 2012 at 5:05

GoogleCodeExporter commented 9 years ago
I experienced this problem on Windows.  Check the following link:
http://stackoverflow.com/questions/3706293/why-do-no-python-dlls-built-with-msvc
-load-with-mod-wsgi

Original comment by cw...@trottertech.com on 28 Aug 2012 at 5:29

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 22 Oct 2012 at 6:05