Operating System - HP-UX
1822004 Members
4010 Online
109639 Solutions
New Discussion юеВ

HP UX - PERL 5.8.8 DBD :: Oracle problem

 
SOLVED
Go to solution
jygnash
Occasional Advisor

HP UX - PERL 5.8.8 DBD :: Oracle problem

Hi there,
My problem is i am executing perl script from command prompt to query the Oracle database. It works fine from command prompt.

But if i try to execuite the script by placing it in Apache and calling it through browser it does not execute and gives out following error in error_log

install_driver(Oracle) failed: Can't load '/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64/auto/DBD/Oracle/Oracle.sl' for module DBD::Oracle: No such file or directory at /opt/perl5/lib/5.8.8/PA-RISC2.0-thread-multi-LP64/DynaLoader.pm line 230.
at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /opt/hpws/apacheNew/cgi-bin/TestDB.pl line 5


>>>>>>>>>>>>>

os : HP-UX srvhp4 B.11.23 U 9000/800
perl 5.8.8 (with threading)
DBI : 1.607
DBD:Oracle - 1.14
>>>>
>>>>>>>>>TestDB.pl
#!/opt/perl5/bin/perl
use DBI;
use CGI;

my $dbh = DBI->connect('dbi:Oracle:', q{websmgr/websmgr@(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP) (HOST=172.18.1.224)(PORT=1521))
(CONNECT_DATA=(SID=WEBS)))}, "") || die "Database connection not made: $DBI::errstr";

my $sql = qq{ select * from EF_DJS_CIRCUIT_ATTENDEES };
my $sth = $dbh->prepare( $sql );
$sth->execute();
while (@data = $sth->fetchrow_array()) {
print"DATA is = "."$data[0]"."\n";
}


$dbh->disconnect();

15 REPLIES 15
Tim Nelson
Honored Contributor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

Need the same environmant vars that you have in your shell to be in apache.

jygnash
Occasional Advisor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

Its shows the same error again... even after
I did exporting the env variable through profile. or even set that variables in httpd.conf as below

SetEnv ORACLE_HOME /orasw/oracle/product/db10g
PassEnv ORACLE_HOME

SetEnv LD_LIBRARY_PATH /orasw/oracle/product/db10g/lib64
PassEnv LD_LIBRARY_PATH

SetEnv LD_RUN_PATH /orasw/oracle/product/db10g/lib64:/orasw/oracle/product/db10g/lib
PassEnv LD_RUN_PATH

SetEnv SHLIB_PATH /orasw/oracle/product/db10g:/orasw/oracle/product/db10g/lib
PassEnv SHLIB_PATH


SetEnv PATH /opt/perl5/bin:/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64/auto/DBD/Oracle:/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64:/orasw/oracle/product/db10g/lib64:/orasw/oracle/product/db10g/lib
PassEnv PATH

SetEnv LD_PRELOAD /opt/perl5/bin:/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64/auto/DBD/Oracle:/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64/:/orasw/oracle/product/db10g/lib64:/orasw/oracle/product/db10g/lib
PassEnv LD_PRELOAD

also exported them manually, but still no result. Its shows the same error again
Tim Nelson
Honored Contributor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

I do not think your web page is going to read a specific users profile.

How about setting the env in the perl script ?

e.g.

$ENV{ORACLE_HOME} = '/u01/oracle/product/10.2';

jygnash
Occasional Advisor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

still failing i edited the perl script to have the following variables
$ENV{ORACLE_HOME} = '/orasw/oracle/product/db10g';
$ENV{SHLIB_PATH}='/orasw/oracle/product/db10g/lib';
$ENV{LD_PRELOAD}='/opt/perl5/bin:/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64/auto/DBD/Oracle:/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64:$ORACLE_HOME:$ORACLE_HOME/lib';
$ENV{LD_RUN_PATH}='/orasw/oracle/product/db10g/lib64:/orasw/oracle/product/db10g/lib';
$ENV{LD_LIBRARY_PATH}='/orasw/oracle/product/db10g/lib';
H.Merijn Brand (procura
Honored Contributor
Solution

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

$ chatr /opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64/auto/DBD/Oracle/Oracle.sl

Will show you what libraries it requires, make sure that SHLIB_PATH and/ot LD_LIBRARY_PATH include the locations to those libraries before you start apache.

Enjoy, Have FUN! H.Merijn [ who'd love to see Oracle 10 die a horrible death ]
Enjoy, Have FUN! H.Merijn
Ralph Grothe
Honored Contributor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

Merijn > [ who'd love to see Oracle 10 die a horrible death ]

(:-)) Do you think PostgreSQL could be Oracle's death blow?
Madness, thy name is system administration
H.Merijn Brand (procura
Honored Contributor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

I would like to hope so, but there is not a single database that doesn't cause people to swear and curse.

It just happens that Oracle manages to make me curse way more than Postgres or Unify.

OK, I'll just use CSV then :)

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
James R. Ferguson
Acclaimed Contributor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

Hi:

> Merijn: OK, I'll just use CSV then :)

Well, that's not surprising :-))

http://search.cpan.org/~hmbrand/Text-CSV_XS-0.54/

Regards!

...JRF...
jygnash
Occasional Advisor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

Still Failing............
I did chatr on Oracle.sl and it showed results as follow

$ chatr Oracle.sl
Oracle.sl:
64-bit ELF shared library
shared library dynamic path search:
LD_LIBRARY_PATH enabled first
SHLIB_PATH enabled second
embedded path enabled third /orasw/oracle/product/db10g/lib64:/lib/pa20_64
shared library list:
libclntsh.sl.10.1
librt.2
libpthread.1
libnsl.1
shared library mapped private disabled
shared vtable support disabled
explicit unloading enabled
linkage table protection disabled
segments:
index type address flags size
5 text 4000000000000000 z---c- D (default)
6 data 8000000100000000 ---m-- D (default)
static branch prediction disabled
kernel assisted branch prediction enabled
lazy swap allocation for dynamic segments disabled
nulptr dereferences trap disabled


I did found out the location of each library and exported with full path as below
export LD_LIBRARY_PATH=/usr/lib:/usr/lib/pa20_64:/orasw/oracle/product/db10g/lib:/orasw/oracle/product/db10g/lib/libclntsh.sl.10.1:/usr/lib/pa20_64/librt.2:/usr/lib/pa20_64/libpthread.1:/usr/lib/pa20_64/libnsl.1
export SHLIB_PATH=/usr/lib:/usr/lib/pa20_64:/orasw/oracle/product/db10g/lib:/orasw/oracle/product/db10g/lib/libclntsh.sl.10.1:/usr/lib/pa20_64/librt.2:/usr/lib/pa20_64/libpthread.1:/usr/lib/pa20_64/libnsl.1
export LD_PRELOAD=/usr/lib:/usr/lib/pa20_64:/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64/auto/DBD/Oracle:/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64:/orasw/oracle/product/db10g:/orasw/oracle/product/db10g/lib
H.Merijn Brand (procura
Honored Contributor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

Do you run a 64bit Apache? If not, I wouldn't know how it could work at all.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
jygnash
Occasional Advisor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

Not working but moved forward a bit....
Yes i have the correct apache because i had built it from the source.

However i was able to figure out the problem by chatr on Oracle.sl as recomended by Merijn Brand. Doing that i found out that the execution permission were not set correctly for user webserver.

so now i am having another trouble

Database connection not made: ERROR OCIEnvNlsCreate. Check ORACLE_HOME env var, NLS settings, permissions, etc. at /opt/hpws/apacheNew/cgi-bin/Test.
H.Merijn Brand (procura
Honored Contributor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

I don't know if in your Oracle the NLS environment ($ORACLE_NLS, $NLS_LANG) has to match you current locale ($LC_ALL, $LANG).

I hate locates that do not match (in decreasing preference) UTF8, ISO-8859-1, or C (7-bit ASCII). There will always be some sort of mismatch.

Then you can create your database in one locale, and (try to) access it in another. That sucks.

Way too many things to check, and way too many points of error.

Enjoy, Have FUN! H.Merijn [ Care to rate the answers? ]
Enjoy, Have FUN! H.Merijn
jygnash
Occasional Advisor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

Well Finally figured out to export the variables and now functioning ok

IF you dont have the oracle variable you can export them through httpd.conf as below

edit the httpd.conf and add the following lines for oracle library

SetEnv ORACLE_HOME /orasw/oracle/product/db10g
PassEnv ORACLE_HOME
SetEnv LD_LIBRARY_PATH=/orasw/oracle/product/db10g/lib
PassEnv LD_LIBRARY_PATH
SetEnv SHLIB_PATH=/orasw/oracle/product/db10g/lib
PassEnv SHLIB_PATH
SetEnv LD_PRELOAD
/opt/perl5/bin:/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64/auto/DBD
/Oracle:/opt/perl5/lib/site_perl/5.8.8/PA-RISC2.0-thread-multi-LP64:/orasw/oracle/product/db10
g:/orasw/oracle/product/db10g/lib
PassEnv LD_PRELOAD
SetEnv LD_RUN_PATH /orasw/oracle/product/db10g/lib64:/orasw/oracle/product/db10g/lib
PassEnv LD_RUN_PATH


Hope that helps.
jygnash
Occasional Advisor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

Thanks for all the support i got.

PLease seee the thread for the solution
V. Nyga
Honored Contributor

Re: HP UX - PERL 5.8.8 DBD :: Oracle problem

Hi jygnash,

please note that you aslo get the bunny assigned if you assign points.
See also:
http://forums11.itrc.hp.com/service/forums/helptips.do?#28
and
http://forums11.itrc.hp.com/service/forums/helptips.do?#33

V.
*** Say 'Thanks' with Kudos ***