RE: DBI->Connect returning UNDEF in cgi but not in standalone pro g
From: Graeme St. Clair (Graeme.St.Clair_at_hds.com)
Date: 03/23/05
- Next message: Christian Merz: "private DBD::Oracle?"
- Previous message: Sunil A.V.: "Thanks. Working! Re: Re: RE: RE: DBI->Connect returning UNDEF in cgi but not in standalone prog"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: dbi-users@perl.org Date: Tue, 22 Mar 2005 17:41:04 -0800
I got this error just the other day. I had transcribed the following from a
script where it worked to another script - and screwed up by just typing
"dbi:Oracle:host" iso "$dbi:Oracle:$host". But this connection call
definitely works to an 8.1.7 sys. In other words, "host" was not a valid
target d-b whereas "FRED.JOE.COM" is (at my location!).
$host = q{FRED.JOE.COM};
$dbh = DBI->connect("dbi:Oracle:$host", $uid, $pw)
or die qq{Unable to connect to $host:<br/>$DBI::errstr\n};
HTH, GStC.
-----Original Message-----
From: Sunil A.V. [mailto:sunilav@rediffmail.com]
Sent: Tuesday, March 22, 2005 3:22 PM
To: dbi-users@perl.org
Cc: Reidy,Ron; Bill.Costa@unh.edu; Tim.Bunce@pobox.com
Subject: Re: RE: RE: DBI->Connect returning UNDEF in cgi but not in
standalone prog
As per Reidy, I printed $DBI::errstr and it turned out to be
"Error: ORA-12154: TNS:could not resolve service name (DBD ERROR:
OCIServerAttach) at myapp_utility.pm"
This probably means Oracle SID or instance name which is 'ledmyapp' is not
being recognized and is not there in tnsnames.ora But I confimed that
tnsnames.ora has ledmyapp. Thats why standalone perl program worked from
command line.
So as per Ron and Bill, I also agree that environment variables might be
incorrect. So I explicitly added $ENV{'ORACLE_HOME'} =
'/opt/oracle/product/9.2.0.6.0_64c';
$ENV{'LD_LIBRARY_PATH'} = '/opt/oracle/product/9.2.0.6.0_64c/lib';
$ENV{'ORACLE_SID'} = 'ledmyapp';
$ENV{'PATH'} =
$ENV{'PATH'}.":/opt/perl5/bin:/opt/oracle/product/9.2.0.6.0_64c/bin";
I printed them also to confirm that additions are being recognized. It is
BUT STILL I AM GETTING THE SAME ERROR.
Do you think any other env variables might be missing OR is there a
different way to set env vars for iPlanet web server perl cgi progs?
On Wed, 23 Mar 2005 Bill.Costa@unh.edu wrote :
>
> Ron.Reidy@arraybiopharma.com recently wrote (in part):
>
> > The fact your code executes from the command line and not the web
> > server indicates either a permissions problme or an environment
> > problem.
>
> I'll second that environment problem observation. When something
> works from the command line but not as a CGI, that's one of the
> first things I check. Here's an ugly Perl script that might
> be of use in comparing the two environments.
>
>
> ...BC
>
>--
>+----------------------------[ Bill.Costa@UNH.EDU ]---+
>| Bill Costa |
>| CIS/TCS -- 1 Leavitt Lane PHONE: +1-603-862-3056 | No good deed...
>| University of New Hampshire | goes unpunished.
>| Durham, NH 03824 USA |
>| |
>+-----------------[ http://pubpages.unh.edu/~wfc/ ]---+
- Next message: Christian Merz: "private DBD::Oracle?"
- Previous message: Sunil A.V.: "Thanks. Working! Re: Re: RE: RE: DBI->Connect returning UNDEF in cgi but not in standalone prog"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|