Settings for a pure Oracle multi-db Django test suite setup

100 views
Skip to first unread message

Ramiro Morales

unread,
Nov 9, 2010, 12:02:19 AM11/9/10
to django-d...@googlegroups.com
Hi all,

I'm setting up a Oracle XE instance on Linux to be able to test Django ORM
changes. This has so far resulted in a couple of small fixes and
a [1]wiki page documenting the process and hopefully any feeback
I get to this email.

Being a total newbie regarding Oracle is th reason I post this question after
a couple of hours trying to get our Django test suite working against
Oracle without errors to no avail.

I know that with this product only a 'XE' database is available and
that the Oracle
backend creates 'tablespaces' for every Django database.

I've reached the point where I can run most tests when
the DATABASES setting only includes the 'default' connection
but obviously I get a bunch of

ConnectionDoesNotExist: The connection other doesn't exist

errors and the following summary:

Ran 2712 tests in 1559.220s
FAILED (failures=28, errors=850, skipped=36, expected failures=1)

When I use a settings file, created after trial and error, containing:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'xe',
'USER': 'djangotest',
'PASSWORD': 'foo',
},
'other': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'xeother',
'USER': 'djangotest2',
'PASSWORD': 'bar',
'TEST_TBLSPACE': 'tblspace_other',
'TEST_TBLSPACE_TMP': 'tblspace_tmp_other',
},
}

the auxiliary test-specific code of the Oracle bckend creates both tablespaces
and their respective users before running them and cleanly deletes all of it
afterwards. But then I get a lot of

DatabaseError: ORA-12520: TNS:listener could not find available
handler for requested type of server

errors and a summary like:

Ran 2746 tests in 2335.718s
FAILED (failures=36, errors=207, skipped=41, expected failures=2)

Has anybody had success with this setup i.e. one where the 'default and 'other'
alias pointing to such an Oracle product/install?. Is it possible at all?

If so, could you please share the relevant Django settings file (not
really, only
the DATABASES setting)?

Thanks,

--
Ramiro Morales

1. http://code.djangoproject.com/wiki/OracleTestSetup

Andrew Kurinnyi

unread,
Nov 9, 2010, 12:15:41 AM11/9/10
to django-d...@googlegroups.com
Hi Ramiro

I've been working with Oracle during the sprints after last DjangoCon,
and had the same problem. I've been told by several people that
the second db can't be oracle and should be something else, like sqlite.

Here is my db settings.

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'XE', # Or path to database file if using sqlite3.
'USER': 'andrew', # Not used with sqlite3.
'PASSWORD': 'djangocon', # Not used with sqlite3.
'HOST': '192.168.2.33', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '1521', # Set to empty string for default. Not used with sqlite3.
},
'other': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'other_db', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
'TEST_NAME': 'other_db',
}
}

Andrew

> --
> You received this message because you are subscribed to the Google Groups "Django developers" group.
> To post to this group, send email to django-d...@googlegroups.com.
> To unsubscribe from this group, send email to django-develop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
>

Ramiro Morales

unread,
Nov 9, 2010, 3:39:23 PM11/9/10
to django-d...@googlegroups.com
Andrew,

On Tue, Nov 9, 2010 at 2:15 AM, Andrew Kurinnyi <pri...@gmail.com> wrote:
> Hi Ramiro
>
> I've been working with Oracle during the sprints after last DjangoCon,
> and had the same problem. I've been told by several people that
> the second db can't be oracle and should be something else, like sqlite.

Thank you very much for your reply. I will test this tonight at home.
Karen had already given me some hints via IRC about havin
to use such a mutiple, heterogeneous DB scheme.

Thanks again for taking the time to share your experiences.

>
> Here is my db settings.
>
> DATABASES = {
>    'default': {
>        'ENGINE': 'django.db.backends.oracle', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>        'NAME': 'XE',                      # Or path to database file if using sqlite3.
>        'USER': 'andrew',                      # Not used with sqlite3.
>        'PASSWORD': 'djangocon',                  # Not used with sqlite3.
>        'HOST': '192.168.2.33',                      # Set to empty string for localhost. Not used with sqlite3.
>        'PORT': '1521',                      # Set to empty string for default. Not used with sqlite3.
>    },
>    'other': {
>        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>        'NAME': 'other_db',                      # Or path to database file if using sqlite3.
>        'USER': '',                      # Not used with sqlite3.
>        'PASSWORD': '',                  # Not used with sqlite3.
>        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
>        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
>        'TEST_NAME': 'other_db',
>    }
> }
>
> Andrew
>

--
Ramiro Morales

Ian Kelly

unread,
Nov 10, 2010, 8:06:29 PM11/10/10
to django-d...@googlegroups.com
On Mon, Nov 8, 2010 at 10:02 PM, Ramiro Morales <cra...@gmail.com> wrote:
Has anybody had success with this setup i.e. one where the 'default and 'other'
alias pointing to such an Oracle product/install?. Is it possible at all?

If so, could you please share the relevant Django settings file (not
really, only
the DATABASES setting)?

Yes, here are the settings I'm using:


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.oracle',
        'NAME': 'xe',
        'USER': 'ikelly',
        'PASSWORD': 'ikelly',
        'OPTIONS': {'threaded': True},
        'TEST_USER': 'django_test_default',
        'TEST_TBLSPACE': 'django_test_default',
        'TEST_TBLSPACE_TMP': 'django_test_default_temp',

    },

    'other': {
        'ENGINE': 'django.db.backends.oracle',
        'NAME': 'xe',
        'USER': 'ikelly',
        'PASSWORD': 'ikelly',
        'OPTIONS': {'threaded': True},
        'TEST_USER': 'django_test_other',
        'TEST_TBLSPACE': 'django_test_other',
        'TEST_TBLSPACE_TMP': 'django_test_other_temp',
    },
}

The key is that NAME should be the same ('xe') for both entries, since you're really establishing two connections to the same database.  The TEST_USER, TEST_TBLSPACE, and TEST_TBLSPACE_TMP entries must be different, however.

Cheers,
Ian

Ramiro Morales

unread,
Nov 11, 2010, 12:26:30 AM11/11/10
to django-d...@googlegroups.com

Wow. Thanks Ian!. With these settings, plus your [1]patch for #11101
(and plus [2]r14510)
things look definitely better in the Oracle front:

----------------------------------------------------------------------
Ran 2804 tests in 1935.104s

FAILED (failures=4, errors=6, skipped=42, expected failures=2)


Will run the test suite against 1.2.X and update the [3]wiki page tomorrow.

--
Ramiro Morales

1. http://code.djangoproject.com/ticket/11101
2. http://code.djangoproject.com/changeset/14510
3. http://code.djangoproject.com/wiki/OracleTestSetup

Reply all
Reply to author
Forward
0 new messages