ibmdb / python-ibmdb-django

IBM DB2 Driver for the Django application Framework
Apache License 2.0
29 stars 42 forks source link

'ibm_db_django' isn't an available database backend with django version 2.0 or 3.1 #61

Closed HowardMartin closed 3 years ago

HowardMartin commented 3 years ago

'ibm_db_django' isn't an available database backend.

Pip List Django 3.1 django-contrib-comments 2.1.0 django-cors-headers 3.7.0 djangorestframework 3.12.2 ibm-db 3.0.3 ibm-db-django 1.4.0.0

DATABASES = { 'default': { 'ENGINE': 'ibm_db_django', 'NAME': 'XXX', 'USER': 'XXX', 'PASSWORD' : 'XXX', 'HOST': 'XXX', 'PORT': 'XXX', 'PCONNECT' : True, }, }

Could someone help, I have followed all the details and versions on readme.md. But I still got some errors. Thank you

praveen-db2 commented 3 years ago

What error you are facing please elaborate.

HowardMartin commented 3 years ago

Thank you for your fast response.

Here is my message error: 'ibm_db_django' isn't an available database backend.

I can choose only between mysql,postgresql, etc. No options on ibm db.

HowardMartin commented 3 years ago

Hereby I attach the screenshot of the error: ibm_db_django

Here is my pip list, I'm trying using django 2.2 and ibm_db_django 1.3 pip

Please help me, Thank you very much.

brittomoses commented 3 years ago

I get the same error as well, I run from IBM i

Traceback (most recent call last): File "/QOpenSys/pkgs/lib/python3.6/site-packages/ibm_db_django/creation.py", line 25, in import ibm_db_dbi as Database File "/QOpenSys/pkgs/lib/python3.6/site-packages/ibm_db_dbi.py", line 42, in import ibm_db ImportError: Could not load module /QOpenSys/pkgs/lib/python3.6/site-packages/ibm_db.so. Dependent module libdb2.a(shr_64.o) could not be loaded. Could not load module libdb2.a(shr_64.o). System error: No such file or directory Could not load module /QOpenSys/pkgs/lib/python3.6/site-packages/ibm_db.so. Dependent module /QOpenSys/pkgs/lib/python3.6/site-packages/ibm_db.so could not be loaded.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/db/utils.py", line 111, in load_backend return import_module('%s.base' % backend_name) File "/QOpenSys/pkgs/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/QOpenSys/pkgs/lib/python3.6/site-packages/ibm_db_django/base.py", line 49, in from ibm_db_django.creation import DatabaseCreation File "/QOpenSys/pkgs/lib/python3.6/site-packages/ibm_db_django/creation.py", line 27, in raise ImportError( "ibm_db module not found. Install ibm_db module from http://code.google.com/p/ibm-db/. Error: %s" % e ) ImportError: ibm_db module not found. Install ibm_db module from http://code.google.com/p/ibm-db/. Error: Could not load module /QOpenSys/pkgs/lib/python3.6/site-packages/ibm_db.so. Dependent module libdb2.a(shr_64.o) could not be loaded. Could not load module libdb2.a(shr_64.o). System error: No such file or directory Could not load module /QOpenSys/pkgs/lib/python3.6/site-packages/ibm_db.so. Dependent module /QOpenSys/pkgs/lib/python3.6/site-packages/ibm_db.so could not be loaded.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 22, in main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/core/management/init.py", line 401, in execute_from_command_line utility.execute() File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/core/management/init.py", line 377, in execute django.setup() File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate app_config.import_models() File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/QOpenSys/pkgs/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/contrib/auth/models.py", line 2, in from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 48, in class AbstractBaseUser(models.Model): File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/db/models/base.py", line 122, in new new_class.add_to_class('_meta', Options(meta, app_label)) File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/db/models/base.py", line 326, in add_to_class value.contribute_to_class(cls, name) File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/db/models/options.py", line 206, in contribute_to_class self.db_table = truncate_name(self.db_table, connection.ops.max_name_length()) File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/db/init.py", line 28, in getattr return getattr(connections[DEFAULT_DB_ALIAS], item) File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/db/utils.py", line 214, in getitem backend = load_backend(db['ENGINE']) File "/QOpenSys/pkgs/lib/python3.6/site-packages/django/db/utils.py", line 126, in load_backend ) from e_user django.core.exceptions.ImproperlyConfigured: 'ibm_db_django' isn't an available database backend. Try using 'django.db.backends.XXX', where XXX is one of: 'mysql', 'oracle', 'postgresql', 'sqlite3'

imavo commented 3 years ago

At today's date 16/April/2021 , on linux, I'm can use Db2-LUW v11.5.5.0 with the following combinations of versions:

python 3.8.5
pip 21.0.1
django framework 3.1.8
regex 2021.4.4
ibm_db 3.0.4
ibm_db_django 1.4.0.0

After configuring the settings.py, the python manage.py test completes successfully, and the python manage.py migrate completes successfully.

So it seems that with correct configurations and module-versions, the ibm_db_django can be once again used with currently supported Db2-LUW versions.

Gussh99 commented 9 months ago

@imavo Gracias esto funciona hasta al dia de hoy

A la fecha de hoy 16/abril/2021, en Linux, puedo usar Db2-LUW v11.5.5.0 con las siguientes combinaciones de versiones:

python 3.8.5
pip 21.0.1
django framework 3.1.8
regex 2021.4.4
ibm_db 3.0.4
ibm_db_django 1.4.0.0

Después de configurar settings.py, se python manage.py testcompleta correctamente y se python manage.py migratecompleta correctamente.

Por lo tanto, parece que con las configuraciones y versiones de módulo correctas, ibm_db_django se puede volver a utilizar con las versiones de Db2-LUW actualmente compatibles.