Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with Perl DBI on AIX

Status
Not open for further replies.

perlme

Programmer
Apr 11, 2008
1
US
I am running a test script to connect to an Oracle 10.2.0.1 64-bit database on AIX 5.2. My script uses the version of Perl installed with the Oracle software for this platform. Here is the script:

#!/u01/apps/oracle/product/10.2.0/perl/bin/perl
use DBI;
$TARGET_SID = "xxx";
$TARGET_ID = "xxx";
$TARGET_PASSWORD="xxx";
$dbh = DBI->connect("dbi:Oracle:$TARGET_SID", $TARGET_ID, $TARGET_PASSWORD)
or die "Can't connect to sid=$TARGET_SID,id=$TARGET_ID: $DBI::errstr";
$qa = q(select name from v$database);
$cr = $dbh->prepare($qa);
$rc = $cr->execute();
while((@l)=$cr->fetchrow_array){
print @l,"\n" ;
}
$cr->finish;
$dbh->disconnect;

It generates the following error:

install_driver(Oracle) failed: Can't load '/u01/apps/oracle/product/10.2.0/perl/lib/site_perl/5.8.3/aix-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: A file or directory in the path name does not exist. at /u01/apps/oracle/product/10.2.0/perl/lib/5.8.3/aix-thread-multi/DynaLoader.pm line 229.
at (eval 1) line 3
Compilation failed in require at (eval 1) line 3.
Perhaps a required shared library or dll isn't installed where expected
at test.pl line 6

Any help is greatly appreciated.

Thanks
 
You may have to try install DBI module again.

Another alternative solution might be, call sqlplus within your perl script and you avoid DBI.

example

Code:
print "Are you sure you want to run this script? (y|N) ";
$a = <STDIN>;
chomp($a);
unless ($a eq "Y" || $a eq "y") {
        die "User cancelled operation";
}

system ("clear\n");

$dbuser= "rdr";
$dbpass = "rdr";

@sql_return = `sqlplus -s $dbuser/$dbpass << SQL_END
set linesize 10000
set pagesize 0
set heading off
set feedback off 
set colsep '|'
select int_id, name from objects where object_class=3 and name is not null and object_instance is not null;
quit
SQL_END
`;   
  

chomp(@sql_return);                                  
@sql_return = trim(@sql_return);  
foreach $i (@sql_return) {
      my ($int_id,$bsc_name)= split /\|/, $i;
      print "INTID:$int_id => BSC:$bsc_name\n";     
}
  
sub trim {
    my @out = @_;
    for (@out) {
        s/^\s+//;          # trim left
        s/\s+$//;          # trim right
    }
    return @out == 1 
              ? $out[0]   # only one to return
              : @out;     # or many
}




dmazzini
GSM/UMTS System and Telecomm Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top