Search code examples
pythonoracle-databaseweb2py

Web2py - Oracle Connection Failure


I'm trying to connect web2py to my my local Oracle DB, installed the cx_Oracle from pip3 and installed Oracle Instant Client.

echo $LD_LIBRARY_PATH
/usr/lib/oracle/19.6/client64/lib:

Web2py version Version 2.19.1-stable+timestamp.2020.03.21.13.06.49.

My db.py, file

db = DAL('oracle://username/password@test')

but got this error:

<class 'RuntimeError'> Failure to connect, tried 5 times: Traceback (most recent call last): File "/home/user/project/web2py/gluon/packages/dal/pydal/base.py", line 507, in __init__ self._adapter = adapter(**kwargs) File "/home/user/project/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 41, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File "/home/user/project/web2py/gluon/packages/dal/pydal/adapters/base.py", line 417, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File "/home/user/project/web2py/gluon/packages/dal/pydal/adapters/base.py", line 85, in __init__ self.find_driver() File "/home/user/project/web2py/gluon/packages/dal/pydal/adapters/base.py", line 134, in find_driver "No driver of supported ones %s is available" % str(self.drivers) RuntimeError: No driver of supported ones ('cx_Oracle',) is available 

Thanks.


Solution

  • Added /usr/lib/oracle/19.6/client64/lib in ld.so.conf file:

    #vim /etc/ld.so.conf
    /usr/lib/oracle/19.6/client64/lib
    

    Then: sudo ldconfig