$> perl -MDBD::Oracle -e 'print "$DBD::Oracle::VERSION\n"'
####
Can't load '/...//sun4-solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: perl: fatal: libclntsh.so.9.0: open failed: No such file or directory at /...//sun4-solaris/DynaLoader.pm line .
####
$> perl -MOracle::OCI -e 'print "$Oracle::OCI::VERSION\n"'
####
Can't locate Oracle/OCI.pm in @INC (@INC contains: ...)
####
#!/bin/csh
# NOTE: '...' is a placeholder for one or more levels of subdirectories
setenv ORACLE_HOME "/.../oracle/product/920"
setenv LD_LIBRARY_PATH $ORACLE_HOME/lib32:/usr/lib:/usr/ucb/lib
setenv ORA_NLS33 $ORACLE_HOME/ocommon/nls/admin/data
setenv NLS_LANG AMERICAN_AMERICA.AL32UTF8
setenv LD_PRELOAD /usr/lib/libthread.so.1
/.../perldbi_with_al32utf8.pl "$1"
####
#!/...path...to...desired...version...of.../perl
use strict;
use warnings;
use DBI; # Load the DBI module
### Attributes to pass to DBI->connect() to disable automatic error checking
my %attr = (
PrintError => 0,
RaiseError => 0,
);
### Connect using the Oracle driver
my $dbh = DBI->connect("DBI:Oracle:", "user", "password", \%attr )
or die "Can't connect to database: ", $DBI::errstr, "\n";
### Be prepared for long fields
$dbh->{LongReadLen} = 100000;
### Prepare the SQL statement for execution
my $sth = $dbh->prepare( "$ARGV[0]" )
or die "Can't prepare SQL statement: ", $dbh->errstr(), "\n";
### Execute the statement in the database
$sth->execute
or die "Can't execute SQL statement: ", $sth->errstr(), "\n";
### Retrieve the returned rows of data
my @row;
while ( @row = $sth->fetchrow_array() ) {
print @row, "\n";
}
warn "Problem in fetchrow_array(): ", $sth->errstr(), "\n"
if $sth->err();
$sth->finish;
### Disconnect from the database
$dbh->disconnect
or warn "Failed to disconnect: ", $dbh->errstr(), "\n";
exit;