Re: Oracle connection issue with perl DBI



In message <ff34489d0712190700r4a387567y6e61f4f61bfaac3@xxxxxxxxxxxxxx>, "Kumar
Ranjan" writes:
I am facing a funny but troubling issue with Perl DBI & Oracle.
When my shell environment does not have ORACLE_HOME path set, my script
works fine. I am connecting
to Oracle DB like this:

#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect("dbi:Oracle:host=xx.gold.com;port=1522;sid=sid",
$eusr, $epas,{RaiseError => 1, AutoCommit => 1})
die "Can not connect : $DBI->errstr ";

Now,
set the ORACLE_PATH to /opt/bin/oracle/9.2.0.8
and I do try to connect but it complains that it can not connect.

Is /opt/bin/oracle/9.2.0.8 the same ORACLE_HOME you used to build
DBD::Oracle?

It must be.


Do these commands work from the shell?
$ env ORACLE_HOME=/opt/bin/oracle/9.2.0.8 /opt/bin/oracle/9.2.0.8/bin/tnsping
'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xx.gold.com)(PORT=1522))(CONNECT_DATA=(SID=sid)))'
$ env ORACLE_HOME=/opt/bin/oracle/9.2.0.8 /opt/bin/oracle/9.2.0.8/bin/sqlplus euser/epas@'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xx.gold.com)(PORT=1522))(CONNECT_DATA=(SID=sid)))'

If not, contact your DBA.

John
groenveld@xxxxxxx

.



Relevant Pages

  • Re: exec command help
    ... Solaris 9 and the program looses the variables when the while loop exits ... for the rest of the script. ... the current shell environment. ...
    (comp.unix.solaris)
  • Re: root cron, written in perl fails when machines reboots
    ... if I kill and restart cron ... So your script depends on your shell environment variables, ...
    (comp.unix.solaris)
  • Re: Korn shell question
    ... |>> How can I tell, from a Korn shell script, if the script ... but will work only on Linux. ... Another approach is to alter your shell environment to always ...
    (Fedora)
  • Re: Korn shell question
    ... |>> How can I tell, from a Korn shell script, if the script is running ... but will work only on Linux. ... Another approach is to alter your shell environment to always set and ...
    (Fedora)
  • "oracle" shell environment
    ... the "oracle" shell environment? ... mode, there is some Oracle stuff under /compat/linux/etc/, but scritpts ... BTW can we change the default shell of the "oracle" user to ... /compat/linux/bin/*sh at the end of the .profile or .login? ...
    (freebsd-questions)