Django Oracle connection as SYS should be as SYSDBA or SYSOPER

1.6k views Asked by At

I'm trying to use Oracle Database for Django. Oracle DB is active and I can connect with SQLDeveloper. But cannot connect from Django to Oracle DB. I got this error:

django.db.utils.DatabaseError: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

I use Conntection Type = Basic, Role = SYSDBA in SQLDeveloper. Where to give this parameters in Django?

My Current setting.py parameters:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.oracle',
        'NAME': 'payman',
        'USER': 'sys',
        'PASSWORD': 'ssys',
        'HOST': '172.55.79.9',
        'PORT': '1521',
    }
}
1

There are 1 answers

0
Bhumi Singhal On

You need to provide this in the 'OPTIONS' to cx_oracle. I set the following while using the full DSN mode:

'OPTIONS': {
            'purity': cx_Oracle.ATTR_PURITY_SELF,
            'mode': cx_Oracle.SYSDBA
        },