I would like to know whether it is possible for the Python(3.8.10)-Django(3.2) to connect to the DB2 with multiple schemas.
Currently, I am using the settings similar to the example in the GitHub
DATABASES = {
'default': {
'ENGINE' : 'ibm_db_django',
'NAME' : 'mydb',
'USER' : 'db2inst1',
'PASSWORD' : 'ibmdb2',
'HOST' : 'localhost',
'PORT' : '50000',
'PCONNECT' : True, #Optional property, default is false
},
'MYSCHEMA': {
'ENGINE' : 'ibm_db_django',
'NAME' : 'mydb',
'USER' : 'db2inst1',
'PASSWORD' : 'ibmdb2',
'HOST' : 'localhost',
'PORT' : '50000',
‘SCHEMA’ : ‘MYSCEHMA’, # no error for adding the ‘SCHEMA’ parameter (or not) until running
'PCONNECT' : True, #Optional property, default is false
}
However, it is using db2inst1 as the default schema. Is it possible to use other schema? For instance, I am using MYSCHEMA for the application. For the above settings, I am not sure what I could fill the schema name in the DATABASE variables.
I have added in corresponding coding:
SomeModel.objects.using(‘MYSCHEMA’).all() #The default is to use the “default” database connection.
Once it is running in the Django, it will show db2inst1.tabname is an undefined name. (Table willing to use: MYSCHEMA.tabname)