Sorry, ignore my previous reply since you figured it out.

It sounds like you have the tnsnames.ora and environment set up
correctly. (Basically, in settings.py, you should either specify just
DATABASE_NAME, so Oracle will use the tnsnames.ora or other lookup
mechainism based on that, or else specify all DATABASE_foo parameters
including DATABASE_HOST and DATABASE_PORT, which effectively bypasses
tnsnames.ora.)

Did you run "manage.py syncdb" or create the necessary tables
otherwise?  Now Django is connecting to Oracle successfully, but
simply running a query that references a table it can't find.

You might try "manage.py dbshell" to drop you into Oracle's sqlplus
command line with the same connection parameters Django's dev server
would use.  Then try "SELECT * FROM mytable" or "DESC mytable" to see
what's visible to those credentials.  If the tables live in a
different schema, you may need to create private synonyms to them in
the Django user's schema--we nearly always end up with that structure
in our Django/Oracle apps.

Hope this helps,

Matt

On Fri, Feb 20, 2009 at 12:50 PM, Brandon Taylor
<btaylordes...@gmail.com> wrote:
>
> OK, I am pretty sure I found out where to put the tns_names.ora file:
> $ORACLE_HOME/network/admin
>
> But, I'm confused as to how to specify the database name. From the
> Django Oracle docs (http://docs.djangoproject.com/en/dev/ref/
> databases/?from=olddocs#id9) they have the SID as the DATABASE_NAME
> setting.
>
> If I set my DATABASE_NAME to my SID, and try to retrieve objects, I
> get:
>
> DatabaseError: ORA-00942: table or view does not exist
>
> ? ? ?
>
> b
>
> On Feb 20, 1:21 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>> Hi Matt,
>>
>> Ok, I modified manage.py to add two environ variables:
>>
>> import os
>> oracle_home = '/Users/bft228/Library/Oracle/instantclient_10_2'
>> os.environ['ORACLE_HOME'] = oracle_home
>> os.environ['DYLD_LIBRARY_PATH'] = oracle_home
>>
>> Now I'm getting an error:
>> DatabaseError: ORA-12505: TNS:listener does not currently know of SID
>> given in connect descriptor
>>
>> Everything I've found online seems to point to a "tnsnames.ora" file
>> that describes the connection information. A co-worker sent me their
>> "tnsnames.ora" file, but I'm unsure where to put this in OS X.
>>
>> My ORACLE_HOME is "/Users/bft228/Library/Oracle/instantclient_10_2"
>>
>> Thoughts?
>> Brandon
>>
>> On Feb 20, 11:04 am, Matt Boersma <m...@sprout.org> wrote:
>>
>> > Brandon,
>>
>> > Usually that error arises from cx_Oracle when the ORACLE_HOME
>> > environment variable isn't set.  Try doing "manage.py shell" and
>> > looking at what's in os.environ--if you don't see ORACLE_HOME set to
>> > the correct location there, try fixing that first.
>>
>> > Matt
>>
>> > On Fri, Feb 20, 2009 at 9:41 AM, Brandon Taylor <btaylordes...@gmail.com> 
>> > wrote:
>>
>> > > Hi everyone,
>>
>> > > I'm using Oracle instantclient_10_2 (Intel), cx_Oracle-5.0.1, OS X
>> > > 10.5.6 (Intel), Python 2.6.1 and Django trunk.
>>
>> > > My built-in server will start up correct, but, when I attempt to get
>> > > objects for a model, I receive the following error:
>>
>> > > InterfaceError: Unable to acquire Oracle environment handle
>>
>> > > Can anyone help me resolve this problem?
>>
>> > > TIA,
>> > > Brandon
> >
>

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

Reply via email to