Re: Oracle connection issue
Hi Brett, I have that environment variable set as well, but no dice. The weird thing is I can connect to Oracle and retrieve objects when running Django in shell, but not through the built in server when executing a view action. Thanks, Brandon On Feb 23, 11:00 am, Brett Parkerwrote: > On 20 Feb 14:43, Brandon Taylor wrote: > > > > > No proxy server configured in FireFox 3. I'm stumped as well. Guess I > > need to have the Oracle people in my office get in touch with their > > support people. There is one other Django person here at the > > University that might be able to help. > > > I'll post my findings here if we're able to come up with a solution. > > > Many thanks to everyone for their help! > > My guess would be that you're missing the oracle shared object files > from the LD_LIBRARY_PATH, so: > echo $LD_LIBRARY_PATH > if it's empty, do: > export LD_LIBRARY_PATH=/path/to/the/oracle/libraries > > And then try starting the server. > > Cheers, > -- > Brett Parker --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
On 20 Feb 14:43, Brandon Taylor wrote: > > No proxy server configured in FireFox 3. I'm stumped as well. Guess I > need to have the Oracle people in my office get in touch with their > support people. There is one other Django person here at the > University that might be able to help. > > I'll post my findings here if we're able to come up with a solution. > > Many thanks to everyone for their help! My guess would be that you're missing the oracle shared object files from the LD_LIBRARY_PATH, so: echo $LD_LIBRARY_PATH if it's empty, do: export LD_LIBRARY_PATH=/path/to/the/oracle/libraries And then try starting the server. Cheers, -- Brett Parker --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
No proxy server configured in FireFox 3. I'm stumped as well. Guess I need to have the Oracle people in my office get in touch with their support people. There is one other Django person here at the University that might be able to help. I'll post my findings here if we're able to come up with a solution. Many thanks to everyone for their help! b On Feb 20, 4:37 pm, Ian Kellywrote: > On Feb 20, 3:26 pm, Brandon Taylor wrote: > > > Yes, I'm just using the built-in server for local development. I've > > restarted it dozens of times, cleared my browser cache, etc. > > > Is the built-in server not compatible with Oracle? If not, I'll just > > get an Apache/mod_wsgi instance running on my MacBook and use that > > instead. Would be nice if I could just use the built-in server though. > > The development server should be fine. You might check whether your > browser is configured to use a proxy server, though. If it is, then I > suspect there may be some caching going on at the proxy server. > > If that's not the problem, then I'm stumped. > > Hope that helps, > Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
On Feb 20, 3:26 pm, Brandon Taylorwrote: > Yes, I'm just using the built-in server for local development. I've > restarted it dozens of times, cleared my browser cache, etc. > > Is the built-in server not compatible with Oracle? If not, I'll just > get an Apache/mod_wsgi instance running on my MacBook and use that > instead. Would be nice if I could just use the built-in server though. The development server should be fine. You might check whether your browser is configured to use a proxy server, though. If it is, then I suspect there may be some caching going on at the proxy server. If that's not the problem, then I'm stumped. Hope that helps, Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
On Feb 20, 3:14 pm, Brandon Taylorwrote: > I think I may have found the culprit (?), but I have no idea how to > fix this. In my project folder, there is a file called sqlnet.log. > Here's the last entry: > > Fatal NI connect error 12505, connecting to: > (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP) > (HOST=devportal2.dcs.its.utexas.edu)(PORT=1521))(CONNECT_DATA= > (SID=viprt.dcs.its.utexas.edu)(CID=(PROGRAM=Python)(HOST=btaylor- > MacBook.local)(USER=root > > VERSION INFORMATION: > TNS for MacOS X Server: Version 10.2.0.4.0 - Production > TCP/IP NT Protocol Adapter for MacOS X Server: Version 10.2.0.4.0 - > Production > Time: 20-FEB-2009 14:00:59 > Tracing not turned on. > Tns error struct: > ns main err code: 12564 > TNS-12564: Message 12564 not found; No message file for > product=network, facility=TNS > ns secondary err code: 0 > nt main err code: 0 > nt secondary err code: 0 > nt OS err code: 0 > > Check out the last value in the connection: USER=root > When I start up my dev server, I usually override port 80 on my Mac, > so I can just run at : localhost/ > > Shouldn't the USER parameter be the DATABASE_USER from settings.py? or > am I smoking crack? I believe that's just the username of the client process. The login credentials shouldn't be included in the DSN. Based on the error code and timestamp, I think this is related to the original error you were getting (ORA-12505: TNS:listener does not currently know of SID) and not the current problem. Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
Yes, I'm just using the built-in server for local development. I've restarted it dozens of times, cleared my browser cache, etc. Is the built-in server not compatible with Oracle? If not, I'll just get an Apache/mod_wsgi instance running on my MacBook and use that instead. Would be nice if I could just use the built-in server though. On Feb 20, 4:20 pm, Ian Kellywrote: > On Feb 20, 3:01 pm, Brandon Taylor wrote: > > > Actually I was referring to my action in views.py to get the Category > > objects: > > > from activity_codes.models import * (this is the auto-generated > > models.py) > > > def home(request): > > categories = Categories.objects.all() > > return render_to_response('test.html', {'categories' : > > categories}) > > Have you restarted the web server since fixing the models? Is there > any caching going on in between your browser and the server? Those > are the only reasons I can think of why it would work in a manage.py > shell, but not in a view. Also, this may seem obvious, but are you > using the same settings and models modules in both places? > > Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
On Feb 20, 3:01 pm, Brandon Taylorwrote: > Actually I was referring to my action in views.py to get the Category > objects: > > from activity_codes.models import * (this is the auto-generated > models.py) > > def home(request): > categories = Categories.objects.all() > return render_to_response('test.html', {'categories' : > categories}) Have you restarted the web server since fixing the models? Is there any caching going on in between your browser and the server? Those are the only reasons I can think of why it would work in a manage.py shell, but not in a view. Also, this may seem obvious, but are you using the same settings and models modules in both places? Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
I think I may have found the culprit (?), but I have no idea how to fix this. In my project folder, there is a file called sqlnet.log. Here's the last entry: Fatal NI connect error 12505, connecting to: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP) (HOST=devportal2.dcs.its.utexas.edu)(PORT=1521))(CONNECT_DATA= (SID=viprt.dcs.its.utexas.edu)(CID=(PROGRAM=Python)(HOST=btaylor- MacBook.local)(USER=root VERSION INFORMATION: TNS for MacOS X Server: Version 10.2.0.4.0 - Production TCP/IP NT Protocol Adapter for MacOS X Server: Version 10.2.0.4.0 - Production Time: 20-FEB-2009 14:00:59 Tracing not turned on. Tns error struct: ns main err code: 12564 TNS-12564: Message 12564 not found; No message file for product=network, facility=TNS ns secondary err code: 0 nt main err code: 0 nt secondary err code: 0 nt OS err code: 0 Check out the last value in the connection: USER=root When I start up my dev server, I usually override port 80 on my Mac, so I can just run at : localhost/ Shouldn't the USER parameter be the DATABASE_USER from settings.py? or am I smoking crack? b On Feb 20, 4:01 pm, Brandon Taylorwrote: > Actually I was referring to my action in views.py to get the Category > objects: > > from activity_codes.models import * (this is the auto-generated > models.py) > > def home(request): > categories = Categories.objects.all() > return render_to_response('test.html', {'categories' : > categories}) > > On Feb 20, 3:34 pm, Ian Kelly wrote: > > > On Feb 20, 2:25 pm, Brandon Taylor wrote: > > > > however attempting to retrieve the Category objects from a view > > > results in: > > > DatabaseError: ORA-00942: table or view does not exist > > > > Thoughts? > > > You can definitely use views with Django (although inspectdb will > > blissfully ignore them). We do that all the time. Again, I'd need to > > see the models.py to understand what's going on. Or it could be that > > the Django user has permissions on the table, but not on the view. > > > Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
Actually I was referring to my action in views.py to get the Category objects: from activity_codes.models import * (this is the auto-generated models.py) def home(request): categories = Categories.objects.all() return render_to_response('test.html', {'categories' : categories}) On Feb 20, 3:34 pm, Ian Kellywrote: > On Feb 20, 2:25 pm, Brandon Taylor wrote: > > > however attempting to retrieve the Category objects from a view > > results in: > > DatabaseError: ORA-00942: table or view does not exist > > > Thoughts? > > You can definitely use views with Django (although inspectdb will > blissfully ignore them). We do that all the time. Again, I'd need to > see the models.py to understand what's going on. Or it could be that > the Django user has permissions on the table, but not on the view. > > Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
On Feb 20, 2:25 pm, Brandon Taylorwrote: > however attempting to retrieve the Category objects from a view > results in: > DatabaseError: ORA-00942: table or view does not exist > > Thoughts? You can definitely use views with Django (although inspectdb will blissfully ignore them). We do that all the time. Again, I'd need to see the models.py to understand what's going on. Or it could be that the Django user has permissions on the table, but not on the view. Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
here's the inspectdb models.py file: from django.db import models class Subtypes(models.Model): id = models.DecimalField(decimal_places=0, max_digits=38, db_column='ID', primary_key=True) # Field name made lowercase. type_id = models.DecimalField(decimal_places=0, null=True, max_digits=38, db_column='TYPE_ID', blank=True) # Field name made lowercase. name = models.CharField(max_length=255, db_column='NAME', blank=True) # Field name made lowercase. created_at = models.DateField(null=True, db_column='CREATED_AT', blank=True) # Field name made lowercase. updated_at = models.DateField(null=True, db_column='UPDATED_AT', blank=True) # Field name made lowercase. class Meta: db_table = u'SUBTYPES' class Types(models.Model): id = models.DecimalField(decimal_places=0, max_digits=38, db_column='ID', primary_key=True) # Field name made lowercase. category_id = models.DecimalField(decimal_places=0, null=True, max_digits=38, db_column='CATEGORY_ID', blank=True) # Field name made lowercase. name = models.CharField(max_length=255, db_column='NAME', blank=True) # Field name made lowercase. created_at = models.DateField(null=True, db_column='CREATED_AT', blank=True) # Field name made lowercase. updated_at = models.DateField(null=True, db_column='UPDATED_AT', blank=True) # Field name made lowercase. class Meta: db_table = u'TYPES' class Categories(models.Model): id = models.DecimalField(decimal_places=0, max_digits=38, db_column='ID', primary_key=True) # Field name made lowercase. name = models.CharField(max_length=255, db_column='NAME', blank=True) # Field name made lowercase. created_at = models.DateField(null=True, db_column='CREATED_AT', blank=True) # Field name made lowercase. updated_at = models.DateField(null=True, db_column='UPDATED_AT', blank=True) # Field name made lowercase. class Meta: db_table = u'CATEGORIES' class Activities(models.Model): id = models.DecimalField(decimal_places=0, max_digits=38, db_column='ID', primary_key=True) # Field name made lowercase. category_id = models.DecimalField(decimal_places=0, null=True, max_digits=38, db_column='CATEGORY_ID', blank=True) # Field name made lowercase. type_id = models.DecimalField(decimal_places=0, null=True, max_digits=38, db_column='TYPE_ID', blank=True) # Field name made lowercase. subtype_id = models.DecimalField(decimal_places=0, null=True, max_digits=38, db_column='SUBTYPE_ID', blank=True) # Field name made lowercase. group_id = models.DecimalField(decimal_places=0, null=True, max_digits=38, db_column='GROUP_ID', blank=True) # Field name made lowercase. subgroup_id = models.DecimalField(decimal_places=0, null=True, max_digits=38, db_column='SUBGROUP_ID', blank=True) # Field name made lowercase. csu_id = models.CharField(max_length=255, db_column='CSU_ID', blank=True) # Field name made lowercase. code = models.CharField(max_length=255, db_column='CODE', blank=True) # Field name made lowercase. description = models.CharField(max_length=255, db_column='DESCRIPTION', blank=True) # Field name made lowercase. comments = models.TextField(db_column='COMMENTS', blank=True) # Field name made lowercase. created_at = models.DateField(null=True, db_column='CREATED_AT', blank=True) # Field name made lowercase. updated_at = models.DateField(null=True, db_column='UPDATED_AT', blank=True) # Field name made lowercase. class Meta: db_table = u'ACTIVITIES' class SchemaMigrations(models.Model): version = models.CharField(unique=True, max_length=255, db_column='VERSION') # Field name made lowercase. class Meta: db_table = u'SCHEMA_MIGRATIONS' On Feb 20, 3:26 pm, Matt Boersmawrote: > Ah...I think specifying db_table as "ACTIVITY_CODE.CATEGORIES" is the > problem. We don't really have schema support in Django (yes, there's > a bug recorded for this issue), and unfortunately the approach of > specifying "schema.table" as the table name will not work. > > You'll probably have to do something like: > CREATE OR REPLACE SYNONYM categories FOR activity_code.categories; > And repeat for the relevant tables, views, or sequences. > > This is particularly problematic for Oracle, which nearly always uses > multiple schemas and specific permission grants in Real World (tm) > schemas. We tried a couple quick, Oracle-specific fixes in the past, > but they were insufficient, and thus we're pinning our hopes on the > "general schema support" enhancement coming someday. > > Shorter me: "What Ian said." > > On Fri, Feb 20, 2009 at 2:15 PM, Brandon Taylor > wrote: > > > Ok, now I am absolutely confounded... > > > I ran: manage.py inspectdb > models.py > > > Then I tried to get objects from the models THAT IT CREATED FOR ME - > > same friggin' error! > > > What in the world is up with this thing? I'm at a loss. > > > b > > > On Feb 20, 3:08 pm, Brandon Taylor
Re: Oracle connection issue
Ah...I think specifying db_table as "ACTIVITY_CODE.CATEGORIES" is the problem. We don't really have schema support in Django (yes, there's a bug recorded for this issue), and unfortunately the approach of specifying "schema.table" as the table name will not work. You'll probably have to do something like: CREATE OR REPLACE SYNONYM categories FOR activity_code.categories; And repeat for the relevant tables, views, or sequences. This is particularly problematic for Oracle, which nearly always uses multiple schemas and specific permission grants in Real World (tm) schemas. We tried a couple quick, Oracle-specific fixes in the past, but they were insufficient, and thus we're pinning our hopes on the "general schema support" enhancement coming someday. Shorter me: "What Ian said." On Fri, Feb 20, 2009 at 2:15 PM, Brandon Taylorwrote: > > Ok, now I am absolutely confounded... > > I ran: manage.py inspectdb > models.py > > Then I tried to get objects from the models THAT IT CREATED FOR ME - > same friggin' error! > > What in the world is up with this thing? I'm at a loss. > > b > > On Feb 20, 3:08 pm, Brandon Taylor wrote: >> Hi Ian, >> >> Here's her's the quick model I wrote to try to select *something*: >> >> class TestCategory(models.Model): >> name = models.CharField(max_length=255) >> class Meta: >> db_table = 'ACTIVITY_CODE.CATEGORIES' >> >> If I connect via dbshell from my project, I can do: select * from >> categories; >> >> and I get 11 records back, which is correct. But, if I try to retrieve >> these via: >> >> from my_app.models import TestCategory >> from django.shortcuts import render_to_response >> >> def test(request): >> categories = TestCategory.objects.all() >> return render_to_response('test.html', {'categories' ; >> categories}) >> >> I get: DatabaseError: ORA-00942: table or view does not exist >> >> ? ? ? >> >> On Feb 20, 2:53 pm, Brandon Taylor wrote: >> >> > Hi Matt, >> >> > Thanks for the reply. Well, I can get connected via sqlplus and I can: >> > desc activities... not sure what's up from the Django side. The user >> > I'm connecting with has correct privileges; my Oracle person has >> > triple-checked. >> >> > If I try to run a syncdb, I get the Oracle environment handle error, >> > even though I've specified that in manage.py. I also have my Oracle >> > home spec'd in my .bashrc and .bash_profile. I have no idea what to >> > try next. ugh. >> >> > b >> >> > On Feb 20, 2:33 pm, Matt Boersma wrote: >> >> > > 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 >> >> > > 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 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 >> >> > >
Re: Oracle connection issue
On Feb 20, 2:08 pm, Brandon Taylorwrote: > Hi Ian, > > Here's her's the quick model I wrote to try to select *something*: > > class TestCategory(models.Model): > name = models.CharField(max_length=255) > class Meta: > db_table = 'ACTIVITY_CODE.CATEGORIES' Don't include the schema name in the db_table setting. Django expects just a table name, and it will quote that and look for a table named "ACTIVITY_CODE.CATEGORIES", which doesn't exist since the table's name is just "CATEGORIES". If the table resides in a different schema, the best approach is to create a private synonym for the table and point Django to the synonym (as I think Matt already mentioned). On Feb 20, 2:15 pm, Brandon Taylor wrote: > Ok, now I am absolutely confounded... > > I ran: manage.py inspectdb > models.py > > Then I tried to get objects from the models THAT IT CREATED FOR ME - > same friggin' error! > > What in the world is up with this thing? I'm at a loss. Could you please post the contents of the models.py that it created? Otherwise, I have no idea what's going on here. Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
Alright, this is what I *am* able to do... manage.py shell (from my project folder) from my_project.models import * categories = Categories.objects.all() print categories (and I get 11 Category objects - woohoo!) from django.db import connection print connection.queries [{'time': '0.007', 'sql': u'SELECT * FROM (SELECT ROWNUM AS "_RN", "_SUB".* FROM (SELECT "CATEGORIES"."ID", "CATEGORIES"."NAME", "CATEGORIES"."CREATED_AT", "CATEGORIES"."UPDATED_AT" FROM "CATEGORIES") "_SUB" WHERE ROWNUM <= 21) WHERE "_RN" > 0'}, {'time': '0.004', 'sql': u'SELECT "CATEGORIES"."ID", "CATEGORIES"."NAME", "CATEGORIES"."CREATED_AT", "CATEGORIES"."UPDATED_AT" FROM "CATEGORIES"'}] however attempting to retrieve the Category objects from a view results in: DatabaseError: ORA-00942: table or view does not exist Thoughts? On Feb 20, 3:15 pm, Brandon Taylorwrote: > Ok, now I am absolutely confounded... > > I ran: manage.py inspectdb > models.py > > Then I tried to get objects from the models THAT IT CREATED FOR ME - > same friggin' error! > > What in the world is up with this thing? I'm at a loss. > > b > > On Feb 20, 3:08 pm, Brandon Taylor wrote: > > > Hi Ian, > > > Here's her's the quick model I wrote to try to select *something*: > > > class TestCategory(models.Model): > > name = models.CharField(max_length=255) > > class Meta: > > db_table = 'ACTIVITY_CODE.CATEGORIES' > > > If I connect via dbshell from my project, I can do: select * from > > categories; > > > and I get 11 records back, which is correct. But, if I try to retrieve > > these via: > > > from my_app.models import TestCategory > > from django.shortcuts import render_to_response > > > def test(request): > > categories = TestCategory.objects.all() > > return render_to_response('test.html', {'categories' ; > > categories}) > > > I get: DatabaseError: ORA-00942: table or view does not exist > > > ? ? ? > > > On Feb 20, 2:53 pm, Brandon Taylor wrote: > > > > Hi Matt, > > > > Thanks for the reply. Well, I can get connected via sqlplus and I can: > > > desc activities... not sure what's up from the Django side. The user > > > I'm connecting with has correct privileges; my Oracle person has > > > triple-checked. > > > > If I try to run a syncdb, I get the Oracle environment handle error, > > > even though I've specified that in manage.py. I also have my Oracle > > > home spec'd in my .bashrc and .bash_profile. I have no idea what to > > > try next. ugh. > > > > b > > > > On Feb 20, 2:33 pm, Matt Boersma wrote: > > > > > 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 > > > > > 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 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 > >
Re: Oracle connection issue
Ok, now I am absolutely confounded... I ran: manage.py inspectdb > models.py Then I tried to get objects from the models THAT IT CREATED FOR ME - same friggin' error! What in the world is up with this thing? I'm at a loss. b On Feb 20, 3:08 pm, Brandon Taylorwrote: > Hi Ian, > > Here's her's the quick model I wrote to try to select *something*: > > class TestCategory(models.Model): > name = models.CharField(max_length=255) > class Meta: > db_table = 'ACTIVITY_CODE.CATEGORIES' > > If I connect via dbshell from my project, I can do: select * from > categories; > > and I get 11 records back, which is correct. But, if I try to retrieve > these via: > > from my_app.models import TestCategory > from django.shortcuts import render_to_response > > def test(request): > categories = TestCategory.objects.all() > return render_to_response('test.html', {'categories' ; > categories}) > > I get: DatabaseError: ORA-00942: table or view does not exist > > ? ? ? > > On Feb 20, 2:53 pm, Brandon Taylor wrote: > > > Hi Matt, > > > Thanks for the reply. Well, I can get connected via sqlplus and I can: > > desc activities... not sure what's up from the Django side. The user > > I'm connecting with has correct privileges; my Oracle person has > > triple-checked. > > > If I try to run a syncdb, I get the Oracle environment handle error, > > even though I've specified that in manage.py. I also have my Oracle > > home spec'd in my .bashrc and .bash_profile. I have no idea what to > > try next. ugh. > > > b > > > On Feb 20, 2:33 pm, Matt Boersma wrote: > > > > 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 > > > > 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 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 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 > > > >> > 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
Re: Oracle connection issue
Could it be the case that your Django/Oracle user has the correct privileges, but the tables aren't in the user's default schema/tablespace? Django queries won't prepend the schema name, ever, so you need to ensure that either the tables were created or owned by the connecting user, or that synonyms exist so that "SELECT * FROM mytable" works, not just "SELECT * FROM myschema.mytable". Did you use sqlplus itself, or get there through "manage.py dbshell"? The latter way should ensure that you're connecting exactly as Django itself does. You could also do "manage.py shell," then run "Activity.objects.all()" or somesuch query, then: "from django.db import connection" "print connection.queries" That will show you the exact SQL that seems to be failing, which hopefully provides us a clue. I can't imagine why you'd get the environment error only when running syncdb, if other manage.py commands work. One other thing you could perhaps check is ensuring that the directory with the Oracle libraries is included in LD_LIBRARY_PATH--I know that's sometimes necessary. I do have a similar setup working on my MacBook Pro, but it's at home unfortunately so I can't examine my environment directly right now. Matt On Fri, Feb 20, 2009 at 1:53 PM, Brandon Taylorwrote: > > Hi Matt, > > Thanks for the reply. Well, I can get connected via sqlplus and I can: > desc activities... not sure what's up from the Django side. The user > I'm connecting with has correct privileges; my Oracle person has > triple-checked. > > If I try to run a syncdb, I get the Oracle environment handle error, > even though I've specified that in manage.py. I also have my Oracle > home spec'd in my .bashrc and .bash_profile. I have no idea what to > try next. ugh. > > b > > On Feb 20, 2:33 pm, Matt Boersma wrote: >> 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 >> >> 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 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 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 >> >> > wrote: >> >> >> > > Hi everyone, >> >> >> > > I'm using Oracle instantclient_10_2 (Intel), cx_Oracle-5.0.1, OS X >>
Re: Oracle connection issue
Hi Ian, Here's her's the quick model I wrote to try to select *something*: class TestCategory(models.Model): name = models.CharField(max_length=255) class Meta: db_table = 'ACTIVITY_CODE.CATEGORIES' If I connect via dbshell from my project, I can do: select * from categories; and I get 11 records back, which is correct. But, if I try to retrieve these via: from my_app.models import TestCategory from django.shortcuts import render_to_response def test(request): categories = TestCategory.objects.all() return render_to_response('test.html', {'categories' ; categories}) I get: DatabaseError: ORA-00942: table or view does not exist ? ? ? On Feb 20, 2:53 pm, Brandon Taylorwrote: > Hi Matt, > > Thanks for the reply. Well, I can get connected via sqlplus and I can: > desc activities... not sure what's up from the Django side. The user > I'm connecting with has correct privileges; my Oracle person has > triple-checked. > > If I try to run a syncdb, I get the Oracle environment handle error, > even though I've specified that in manage.py. I also have my Oracle > home spec'd in my .bashrc and .bash_profile. I have no idea what to > try next. ugh. > > b > > On Feb 20, 2:33 pm, Matt Boersma wrote: > > > 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 > > > 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 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 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 > > >> > 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
Re: Oracle connection issue
Hi Matt, Thanks for the reply. Well, I can get connected via sqlplus and I can: desc activities... not sure what's up from the Django side. The user I'm connecting with has correct privileges; my Oracle person has triple-checked. If I try to run a syncdb, I get the Oracle environment handle error, even though I've specified that in manage.py. I also have my Oracle home spec'd in my .bashrc and .bash_profile. I have no idea what to try next. ugh. b On Feb 20, 2:33 pm, Matt Boersmawrote: > 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 > > 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 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 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 > >> > 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
On Feb 20, 12:50 pm, Brandon Taylorwrote: > 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. Those docs could use some clarification. If you specify the database host and port, then DATABASE_NAME is indeed the SID. If you don't specify host and port, then DATABASE_NAME is the TNS name that will be used to look up the connection info. > 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 Regardless of the above, this error suggests that you are in fact successfully connecting now, but that the tables Django is looking for don't exist. This could be because you haven't run Django's syncdb command [http://docs.djangoproject.com/en/dev/ref/django-admin/ #syncdb] to create the tables; or if you're connecting to a legacy database, because Django is looking for its automatically generated table names and not finding them. In the latter case, you should specify the 'db_table' Meta option [http://docs.djangoproject.com/en/ dev/ref/models/options/#db-table] on each of your models to the actual name of the table. Hope this helps, Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
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 Taylorwrote: > > 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 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 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 >> > 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
Good, that's progress actually! So now cx_Oracle is finding the oracle libs correctly and giving up when it can't figure out how to connect to the database you've specified. So it needs to use one of Oracle's naming mechanisms to resolve the database location, such as LDAP or Oracle's own TNSNAMES.ORA flat file. Typically the client looks for $ORACLE_HOME/network/admin/tnsnames.ora. If you don't have that file or that directory structure under /Users/bft228/Library/Oracle/instantclient_10_2, you should go ahead and create them. Then try connecting again, and either it will work fine, or you'll have to do some editing of TNSNAMES.ORA to ensure hostnames and ports are all correct. There are ways to customize the location of TNSNAMES.ORA through environment variables, or to specify which set of naming methods to try, but probably this is sufficient for your use. Matt On Fri, Feb 20, 2009 at 12:21 PM, Brandon Taylorwrote: > > 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 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 >> 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
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 Taylorwrote: > 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 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 > > 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
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 Boersmawrote: > 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 > 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 -~--~~~~--~~--~--~---
Re: Oracle connection issue
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 Taylorwrote: > > 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 -~--~~~~--~~--~--~---