Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9208557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:38:33+00:00 2026-06-18T00:38:33+00:00

I have a Django program that is connecting to an Oracle database. In my

  • 0

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?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:38:35+00:00Added an answer on June 18, 2026 at 12:38 am

    Installing the full Oracle client (with Administrator tools) seems to have solved the problem. There are some nuances to take care of though:

    wsgi.py requires the location of ORACLE_HOME, as it is not passed in from the shell. In my case, this is what wsgi.py looks like:

    import os, sys
    sys.path.append('/var/www/')
    os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
    os.environ['ORACLE_HOME'] = '/client/oracle/product/11.2.0/db'
    from django.core.wsgi import get_wsgi_application
    application = get_wsgi_application()
    

    In Oracle 11.2.0 client there is a bug with the library linking. To fix Oracle library linking:

    1. Navigate to $ORACLE_HOME/lib (in my case, /client/oracle/product/11.2.0/db/lib/)
    2. Remove file libexpat.so.1
    3. As user oracle: create a symbolic link: libexpat.so.1 –> libexpat.so.1.5.2

    Additionally, it is important to have the Linux loader set up properly. (Note: this is equivalent to setting LD_LIBRARY_PATH, but I think the following is a cleaner solution). Create a file /etc/ld.so.conf.d/oracle.conf with a single line entry to the Oracle Home library path. In my case, it’s /client/oracle/product/11.2.0/db/lib. Then run ldconfig. To verify that the loader is configured correctly you can check the shared object paths for cx_Oracle:

    To find the file: as superuser, execute updatedb and then locate cx_Oracle.so | grep cx_Oracle\.so$

    To test the file: ldd <path>

    The output should look similar to this (below). If you see the phrase “not found” then something is wrong with the loader paths.

    # ldd /usr/lib/python2.7/site-packages/cx_Oracle.so
        linux-gate.so.1 =>  (0xb775c000)
        libclntsh.so.11.1 => /client/oracle/product/11.2.0/db/lib/libclntsh.so.11.1 (0xb5a25000)
        libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0xb588e000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb5873000)
        libc.so.6 => /lib/libc.so.6 (0xb56c2000)
        libnnz11.so => /client/oracle/product/11.2.0/db/lib/libnnz11.so (0xb5474000)
        libdl.so.2 => /lib/libdl.so.2 (0xb546f000)
        libm.so.6 => /lib/libm.so.6 (0xb5444000)
        libnsl.so.1 => /lib/libnsl.so.1 (0xb5429000)
        libaio.so.1 => /lib/libaio.so.1 (0xb5427000)
        libutil.so.1 => /lib/libutil.so.1 (0xb5422000)
        /lib/ld-linux.so.2 (0x487b9000)
    

    For convenience, you’ll probably also want to create the file /etc/profile.d/oracle.sh with these contents (note, change ORACLE_HOME to your specific install path):

    export ORACLE_HOME=/client/oracle/product/11.2.0/db
    export PATH=$PATH:$ORACLE_HOME/bin
    

    Reboot for these global environment variables to take effect.

    After that, Oracle connections should work in any scenario. I hope this information helps others who’ve had trouble with Oracle!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Python program (with Django - does this matter?) that I want
I have program that requires Python 3, but I develop Django and it uses
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
I have a scala program that I would like to call from within django
I have a C# program that inserts a pdf inside a MySQL database. Now
In my Django web app, I have a worker program that is a client
I have a Python program (precisely, a Django application) that starts a subprocess using
I have a Django database, in which I have some JSON stored. I wish
I have a Django model that relies on a tuple. I'm wondering what the
We have a custom built program that needs authenticated/encrypted communication between a client and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.