On Wed, 2008-08-13 at 02:32 -0700, Debraj wrote: > Hi > > The script ( mentioned below ) works fine if I do a > > setenv LD_LIBRARY_PATH /OracleProd/oracle9i/lib/ > > before executing the script. But if I don't do that instead put it > within the script like : > > > $ENV{'LD_LIBRARY_PATH'} = "/OracleProd/oracle9i/lib"; > > it throws this error : > > DBI version is --> 1.13 > > install_driver(Oracle) failed: Can't load '/usr/local/bin/perl_5.6.1/ > lib/site_perl/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: > libclntsh.so.9.0: cannot open shared object file: No such file or > directory at /usr/local/bin/perl_5.6.1/lib/5.6.1/i686-linux/ > DynaLoader.pm line 206. > at (eval 1) line 3 > Compilation failed in require at (eval 1) line 3. > > at test2.pl line 18 > > > > > the script is : > > #!/usr/local/bin/perl > use File::Find; > > # All Perl DBI scripts must have this line > use DBI; > #use DBD::Oracle qw(:ora_types); > #use DBD::Oracle; > > # Database Connection stuff > $ENV{'ORACLE_HOME'}="/OracleProd/oracle9i"; > $ENV{'LD_LIBRARY_PATH'} = "/OracleProd/oracle9i/lib"; > > print "DBI version is --> $DBI::VERSION\n\n"; > > $u = "ask"; > $p = "a5k"; > > $dbh = DBI-> > connect("dbi:Oracle:host=ap6002fems.google.com;sid=sidddb;port=1617", > $u, $p, > { > RaiseError => 1, > AutoCommit => 0 > } > ) > or die "Couldn't connect to database: " . DBI-> errstr; > > $dbh->{LongReadLen} = 512 * 1024; > $dbh->{LongTruncOk} = 1; > >
I don't have Oracle on my machine so this is untested. The `use DBI;` is done at compile time. The `$ENV{...` is done at run time, after the compile. Try: BEGIN { $ENV{'ORACLE_HOME'}="/OracleProd/oracle9i"; $ENV{'LD_LIBRARY_PATH'} = "/OracleProd/oracle9i/lib"; use DBI; } -- Just my 0.00000002 million dollars worth, Shawn "Where there's duct tape, there's hope." "Perl is the duct tape of the Internet." Hassan Schroeder, Sun's first webmaster -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/