Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: (OT) DBD error Ora-12154

by Codon (Friar)
on Apr 13, 2006 at 17:50 UTC ( #543165=note: print w/ replies, xml ) Need Help??


in reply to (OT) DBD error Ora-12154

Try breaking things down into smaller pieces to find out where it's breaking, so you can work on the solution. Start with a simple script that just dumps $ENV{'ORACLE_HOME'}, checks the existence (and permissions) of "$ENV{'ORACLE_HOME'}/network/admin/tnsnames.ora"; looks for the desired SID in that file, then tries to connect to that data base. If it works from a simple script, then your lager application must have some bug.

#!/usr/bin/perl use warnings; use strict; use DBI; print "ORACLE_HOME: $ENV{'ORACLE_HOME'}\n"; my $tnsnames = "$ENV{'ORACLE_HOME'}/network/admin/tnsnames.ora"; -e $tnsnames || die "$tnsnames does not exist\n"; -r $tnsnames || die "cannot read $tnsnames\n"; open( TNS, '<', $tnsnames ) || die "could not open $tnsnames for readi +ng"; my $sid = 'development'; my $found_it = 0; while (<TNS>) { if ( /\b$sid\b/ ) { print "found $sid\n"; $found_it++; last; } } die "didn't find $sid\n" unless $found_it; close TNS; print "connecting to $sid\n"; my ($user, $pass) = qw( ... ... ); my $dbh = DBI->connect("dbi:Oracle:$sid",$user,$pass,{ RaiseError => 1 + }) || die "could not connect: $!\n"; print "connected!\n"; print "doing a simple query\n"; my $result = $dbh->selectall_arrayref('select sysdate from dual'); print "sysdate: @{ [ map { @{ $_ } } @$result ] }\n"; $dbh->disconnect;

Ivan Heffner
Sr. Software Engineer, DAS Lead
WhitePages.com, Inc.


Comment on Re: (OT) DBD error Ora-12154
Download Code
Re^2: (OT) DBD error Ora-12154
by Anonymous Monk on Apr 13, 2006 at 18:57 UTC
    Thanks for the help everyone... I will try this and see what happens.. I really appreciate all the feed back....
Re^2: (OT) DBD error Ora-12154
by Anonymous Monk on Apr 13, 2006 at 19:54 UTC
    I tried running this script and I get error stating "Use of uninitialized value in concatenation (.) or string at H:scripts\orcl_test.pl line 8 and line 9". So basically it doesnt know what "$ENV{'ORACLE_HOME'}/network/admin/tnsnames.ora" means??

      Is ORACLE_HOME a variable that is defined? You may need to set up your environment first.

      Also, you could check out tnsping from your new computer, this will help determine if you really can get to the database or not with your current config.

        Heres something else that is really odd. Even though SQL Plus and Benthic work, I cant connect using an ODBC connection to Oracle using Windows XPs ODBC Data Source Admin, which I was able to do on my old computer. It also gives me the same error as when I run my perl scripts.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://543165]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (16)
As of 2014-08-29 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (282 votes), past polls