No it was .profile of mine. Now I have set the LD_LIBRARY_PATH in app.wsgi as mentioned below and when I print the os.environ in the beginning of views.py then it shows that newly added value.
os.environ["LD_LIBRARY_PATH"] = "/opt/app/oracle/products/11.2.0/lib" Is there any problem in this statement for connecting the database? The error show in this line only. I tried all the 3 way, but nothing is working. connection = cx_Oracle.Connection("%s/%s@%s" % ('foo', 'baar', 'db')) connection = cx_Oracle.connect("foo/baar@db") connection = cx_Oracle.connect('foo/baar@db') But Still the issue is not resolved. Thanks, On Sat, Apr 23, 2011 at 2:42 AM, Jirka Vejrazka <jirka.vejra...@gmail.com>wrote: > .profile of which user? Yours or the one running webserver? Have you > confirmed that these are set (e.g. by writing those to a file at the > beginning of your views.py)? > > Cheers > > Jirka > > On 22/04/2011, kamal sharma <kamalp.sha...@gmail.com> wrote: > > Yes, i am getting this error when i used from the web application. Also > all > > the > > user have the permission to webserver to read all Oracle client files. > > > > Not sure how it got set to LD_LIBRARY_PATH > > /opt/apache-2.2.16/lib:/usr/local/lib: > > > > I have defined the LD_LIBRARY_PATH and ORACLE_HOME as follows in .profile > > > > export ORACLE_HOME=/opt/app/oracle/products/11.2.0 > > export LD_LIBRARY_PATH=/opt/app/oracle/products/11.2.0/lib > > > > Also tried it in .cshrc file also. But nothing is working. > > > > setenv ORACLE_HOME "/opt/app/oracle/products/11.2.0" > > setenv LD_LIBRARY_PATH "$ORACLE_HOME/lib32:$ORACLE_HOME/lib" > > setenv LD_LIBRARY_PATH /usr/X11R6/lib:/usr/local/lib > > > > > > I have written a sample script and it works, when i run from the command > > prompt. > > > > filename: test_db.py > > import cx_Oracle > > from pprint import pprint > > > > connection = cx_Oracle.Connection("%s/%s@%s" % ('foo', 'bar', 'db')) > > cursor = cx_Oracle.Cursor(connection) > > sql = "SELECT name FROM prs where rownum < 10" > > cursor.execute(sql) > > data = cursor.fetchall() > > pprint(data) > > cursor.close() > > connection.close() > > > > Getting proper output: > > > > [me] ~/install_cx_oracle> /usr/local/bin/python test_db.py > > [('Robert Craig',), > > ('Darren Kerr',), > > ('Aviva Garrett',), > > ('Pasvorn Boonmark',), > > ('Dave Wittbrodt',), > > ('Pasvorn Boonmark',), > > ('Rajkumaran Chandrasekaran',), > > ('Pasvorn Boonmark',), > > ('Pasvorn Boonmark',)] > > > > But samething when i write in django views.py then getting exception. > > > > > > Request Method: GET > > Request URL: https://server/web/test/cases > > Django Version: 1.2.1 > > Exception Type: DatabaseError > > Exception Value: Error while trying to retrieve text for error ORA-01804 > > Exception Location: /web/views.py in cases, line 43 > > Python Executable: /bin/python > > Python Version: 2.6.6 > > > > Thanks, > > > > > > > > On Thu, Apr 21, 2011 at 3:37 PM, kamalp.sha...@gmail.com < > > kamalp.sha...@gmail.com> wrote: > > > >> Hi, > >> > >> I have installed cx_Oracle module in one of my Solaris box and then > >> trying to create a django page to read data from oracle db. But I am > >> getting following errors. > >> > >> > >> mod_wsgi (pid=2600): Exception occurred processing WSGI script '/opt/ > >> www/ui/foo/web/app.wsgi'. > >> Traceback (most recent call last): > >> File "/opt/www/ui/foo/web/app.wsgi", line 30, in application > >> return _application(environ, start_response) > >> File "/usr/local/packages/python/2.6.6/lib/python2.6/site-packages/ > >> django/core/handlers/wsgi.py", line 230, in __call__ > >> self.load_middleware() > >> File "/usr/local/packages/python/2.6.6/lib/python2.6/site-packages/ > >> django/core/handlers/base.py", line 42, in load_middleware > >> raise exceptions.ImproperlyConfigured('Error importing middleware %s: > >> "%s"' % (mw_module, e)) > >> ImproperlyConfigured: Error importing middleware web.web.framework: > >> "ld.so.1: httpd: fatal: libclntsh.so.11.1: open failed: No such file > >> or directory" > >> > >> > >> I have tried from python shell and i can able to import cx_Oracle > >> module as follows: > >> > >> bash-3.00$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib > >> bash-3.00$ python > >> Python 2.4.4 (#1, Jan 10 2007, 01:25:01) [C] on sunos5 > >> Type "help", "copyright", "credits" or "license" for more information. > >> >>> import cx_Oracle > >> >>> > >> > >> But from the web I am getting the ImproperlyConfigured: configured > >> error. Can someone please help me to resolve this issue. > >> > >> FYI, > >> > >> I have followed this link to install cx_oracle module. > >> > >> > http://agiletesting.blogspot.com/2005/05/installing-and-using-cxoracle-on-unix.html > >> > >> Please let me know if you need more info. > >> > >> Thanks, > >> Kamal > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Django users" group. > >> To post to this group, send email to django-users@googlegroups.com. > >> To unsubscribe from this group, send email to > >> django-users+unsubscr...@googlegroups.com. > >> For more options, visit this group at > >> http://groups.google.com/group/django-users?hl=en. > >> > >> > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.