I am running into a issue, which makes the return code of PERL as -1 after making connection to ORACLE thru DBI, evenif the script is successful. This is happening on recently upgraded 10g version.
The script is quite simple. The script and execution is shown below (commands highlighted). Please let us know if you have seen something similar and do you know of any way to fix this situation.
/usr/local/wics/salil> echo $ORACLE_SID
w002d
/usr/local/wics/salil> echo $LD_LIBRARY_PATH
/usr/openwin/lib:/opt/SUNW
spro/lib:/
usr/dt/lib
32:/opt/or
acle/produ
ct/10.2.0.
4/lib:/opt
/oracle/pr
oduct/10.2
.0.4/lib32
/usr/local/wics/salil> cat dbi_connection_return_val.
pl
#!/usr/local/bin/perl
eval 'use Oraperl; 1' || die $@ if $] >= 5;
$ls_output = `ls`;
print "\n... Return code after simple LS execution: [$?]\n";
print "\n... Logging in to ORACLE via DBI\n";
$log_in = &ora_login("","","") || die ("login failed : $! \n ");
print "... Login successful!\n\n";
&ora_logoff($log_in);
$ls_output = `ls`;
print "... Return code after simple LS execution: [$?]\n\n";
/usr/local/wics/salil> dbi_connection_return_val.
pl
... Return code after simple LS execution: [0]
... Logging in to ORACLE via DBI
... Login successful!
... Return code after simple LS execution: [-1]
/usr/local/wics/salil>
==========================
=========
Hi Keshav,
Did we encounter these errors? Could it be because of the Signal issue?
==========================
==========
==========
====
__________________________
__________
_________
Hi Macneil,
We are migrating from 9i to 10G and our perl scripts needs to change to use 5.8.7. We were testing our perl scripts and noticed that to be able to login to our database , we have to make the input in ora_login procedure to be all null (which means we have to rely on the environment variables) .
Looking back on AFS, when you migrated, I remember you encounter the same error. The error we encounter is ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach) . Did you encounter same problem? Can you share your knowledge on this?
Can we also setup a meeting with you regarding the perl migration?
CODE :
#!/opt/perl5.8.7/bin/perl
# MUST Have these eval statments to use DBI !!
eval '$Oraperl::safe = 1' if $] >= 5;
eval 'use Oraperl; 1' || die $@ if $] >= 5;
$DBHandle=&ConnectDBNoInpu
t;
$DBHandle=&ConnectDBWithIn
putWorld;
$DBHandle=&ConnectDBWithIn
put;
# this is fine
sub ConnectDBNoInput {
printf "DB Input = No Input \n";
my $dbh=&ora_login("","","")|
|&CheckOra
Error;
printf "This works - no input \n";
printf "Login Success $dbh \n";
return $dbh;
}
# this is fine
sub ConnectDBWithInputWorld {
printf "DB Input = w002d.world \n";
my $dbh=&ora_login("w002d.wor
ld","user"
,"pswd")||
&CheckOraE
rror;
printf "This works - w002d.world \n";
printf "Login Success $dbh \n";
return $dbh;
}
# this has ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach)
sub ConnectDBWithInput {
printf "DB Input = w002d \n";
my $dbh=&ora_login("w002d","u
ser","pswd
")||&Check
OraError;
printf "This works - w002d \n";
printf "Login Success $dbh \n";
return $dbh;
}
sub CheckOraError {
print "$ora_errstr\n";
exit 1;
}