On 25 tammi, 00:27, Dylan Klomparens <
dylan.klompar...@gmail.com>
wrote:
> I have a Django program that is connecting to an Oracle database. In my
> settings.py file I have this configuration:
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.oracle',
> 'NAME': 'xe',
> 'USER': 'MY_USER_NAME',
> 'PASSWORD': 'abcdefghijklmnopqrstuvwxyz',
> 'HOST': '
db_server.example.com',
> 'PORT': '1234',
> }}
>
> I received a strange error when attempting to load the website:
>
> ORA-28547: connection to server failed, probable Oracle Net admin error
>
> After further investigation, I sniffed the TCP traffic between the
> webserver and the database server. I discovered this text in the network
> communication, which I reformatted for this post:
>
> (DESCRIPTION=
> (ADDRESS=
> (PROTOCOL=TCP)
> (HOST=1.2.3.4)
> (PORT=1234)
> )
> (CONNECT_DATA=
> (SID=xe)
> (CID=
> (PROGRAM=httpd@webserver_hostname)
> (HOST=webserver_hostname)
> (USER=apache)
> )
> ))
>
> So my question is: why is Django attempting to connect to the Oracle
> database with different credentials than the ones I specified? Notably, it
> is attempting to use user 'apache' instead of 'MY_USER_NAME'. The database
> host IP, port, and SID are correct and what I specified. It just appears to
> be the user name that is different.
>
> (As a side note, I suppose the password is transmitted separately in a
> later portion of the log in process?)
My understanding is that the USER in there isn't the username for
Oracle login, it is the username of current user running the program.
If everything else is OK but you have wrong username you should get an
error telling you that username or password was incorrect.
- Anssi