Q : How do specify that Django needs to connect to Oracle DB using the service name and not SID ?
Hi,
I am currently telling my Django configuration to connect to Oracle using my SID.
However, I'll need to connect using the service name and not the SID.
APP_DATABASES={
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'myservice',
'USER': 'system',
'PASSWORD': 'admin123',
'HOST': '192.168.1.45',
'PORT': '1699',
}
}
This works fine.
However, When I replace the 'NAME' with the service name as follows
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'myservice.bose.com',
'USER': 'system',
'PASSWORD': 'admin123',
'HOST': '192.168.1.45',
'PORT': '1699',
}
I get a
ORA-12505: TNS:listener does not currently know of SID given in connect descriptor
Clearly Django is telling Oracle to connect using the SID which is not what I want Django to do.
How do specify that Django needs to connect to Oracle DB using the service and not SID ?
Note : I've tested that the service name mentioned above. It works great from Oracle SQL Developer.
Thanks - would really appreciate leads.
Thanks guys, There's a "documented" solution to this:
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'host.db.com:1699/oracle_service.db.com',
'USER': 'user',
'PASSWORD': 'pass',
}
Note: The HOST and PORT keys need to be left out of the dictionary - else Django will try connecting with the complete "NAME" as an SID.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With