RE: question for DBD-Oracle driver

RE: question for DBD-Oracle driver

am 09.04.2008 17:04:16 von pcapacio

>>On March 28, Fred Vachon said:
>>I have DBI and DBD::Oracle installed on a Solaris 10 machine.=20
>>When I run either of the 2 commands that were posted I error out with:

>>perl -MDBD::Oracle -le 'print $DBD::Oracle::VERSION;'
>>Can't load
'/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBD/Orac le/Oracle.so
'=20
>>for module DBD::Oracle: ld.so.1: perl: fatal: .
>> at -e line 0
>>I'm thinking it might be an issue with PATH or LD_LIBRARY_PATH but I
>>haven't been able to find it.

I believe you are correct, and that this is another dynamic install.
Solaris doesn't have the chatr command but you can use ldd to get
similar information.
Specifically, issue:=20
ldd
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBD/Oracl e/Oracle.so

Although this doesn't show the libraries it shows what parts are
missing.=20
Do a 'find' for these parts and once you locate them, add the location
to
your LD_LIBRARY_PATH.=20
Example for the following output:
$ ldd
/opt/Perl5/lib/perl5/site_perl/5.6.0/sun4-solaris/auto/DBD/O racle/Oracle
..so
libclntsh.so.8.0 =3D> (file not found)
libwtc8.so =3D> (file not found)
libnsl.so.1 =3D> /usr/lib/libnsl.so.1
libsocket.so.1 =3D> /usr/lib/libsocket.so.1
libdl.so.1 =3D> /usr/lib/libdl.so.1
libsched.so.1 =3D> /usr/lib/libsched.so.1
libaio.so.1 =3D> /usr/lib/libaio.so.1
libposix4.so.1 =3D> /usr/lib/libposix4.so.1
libkstat.so.1 =3D> /usr/lib/libkstat.so.1
libm.so.1 =3D> /usr/lib/libm.so.1
libthread.so.1 =3D> /usr/lib/libthread.so.1
libc.so.1 =3D> /usr/lib/libc.so.1
libmp.so.2 =3D> /usr/lib/libmp.so.2
/usr/platform/SUNW,Ultra-80/lib/libc_psr.so.1

I did a find for the files not found then added the locations to my
environ vars:

export ORACLE_HOME=3D/usr/oracle/product/8.1.7
export TNS_ADMIN=3D??? (location of your tnsnames.ora)
export PATH=3D/usr/oracle/product/8.1.7/bin:$PATH
export LD_LIBRARY_PATH=3D$ORACLE_HOME/lib:/usr/lib

I hope this helps.
Paula

Re: question for DBD-Oracle driver

am 09.04.2008 17:47:31 von pgodfrin

On Apr 9, 10:04 am, PCAPA...@amfam.com (Paula J Capacio) wrote:
> >>On March 28, Fred Vachon said:
> >>I have DBI and DBD::Oracle installed on a Solaris 10 machine.
> >>When I run either of the 2 commands that were posted I error out with:
> >>perl -MDBD::Oracle -le 'print $DBD::Oracle::VERSION;'
> >>Can't load
>
> '/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBD/Orac le/Oracle.so
> '
>
> >>for module DBD::Oracle: ld.so.1: perl: fatal: .
> >> at -e line 0
> >>I'm thinking it might be an issue with PATH or LD_LIBRARY_PATH but I
> >>haven't been able to find it.
>
> I believe you are correct, and that this is another dynamic install.
> Solaris doesn't have the chatr command but you can use ldd to get
> similar information.
> Specifically, issue:
> ldd
> /usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBD/Oracl e/Oracle.so
>
> Although this doesn't show the libraries it shows what parts are
> missing.
> Do a 'find' for these parts and once you locate them, add the location
> to
> your LD_LIBRARY_PATH.
> Example for the following output:
> $ ldd
> /opt/Perl5/lib/perl5/site_perl/5.6.0/sun4-solaris/auto/DBD/O racle/Oracle
> .so
> libclntsh.so.8.0 => (file not found)
> libwtc8.so => (file not found)
> libnsl.so.1 => /usr/lib/libnsl.so.1
> libsocket.so.1 => /usr/lib/libsocket.so.1
> libdl.so.1 => /usr/lib/libdl.so.1
> libsched.so.1 => /usr/lib/libsched.so.1
> libaio.so.1 => /usr/lib/libaio.so.1
> libposix4.so.1 => /usr/lib/libposix4.so.1
> libkstat.so.1 => /usr/lib/libkstat.so.1
> libm.so.1 => /usr/lib/libm.so.1
> libthread.so.1 => /usr/lib/libthread.so.1
> libc.so.1 => /usr/lib/libc.so.1
> libmp.so.2 => /usr/lib/libmp.so.2
> /usr/platform/SUNW,Ultra-80/lib/libc_psr.so.1
>
> I did a find for the files not found then added the locations to my
> environ vars:
>
> export ORACLE_HOME=/usr/oracle/product/8.1.7
> export TNS_ADMIN=??? (location of your tnsnames.ora)
> export PATH=/usr/oracle/product/8.1.7/bin:$PATH
> export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
>
> I hope this helps.
> Paula

Another approach is to use the ld configuration 'structure' (I'm a DBA
not an SA so I'm not sure of the terminology). In /etc/ld.so.conf:
include ld.so.conf.d/*.conf

This will search the ld.so.conf.d direcotry for files like *.conf, and
load their contents at startup, or when the ldconfig command is
issued. In ld.si.conf.d/ (for my Fedora 8 system):

-rw-r--r-- 1 root root 15 2007-12-14 02:03 mysql-i386.conf
-rw-r--r-- 1 root root 73 2007-08-22 04:12 opensync-32.conf
-rw-r--r-- 1 root root 29 2008-03-03 13:34 oracle-10203.conf
-rw-r--r-- 1 root root 20 2008-01-24 09:38 qt-i386.conf
-rw-r--r-- 1 root root 15 2006-01-02 03:04 wine-32.conf

(btw - some errors occur complaining about '...empty, not checked' -
don't know what that means...)

In oracle-10203.conf:

/oracle/product/10.2.0.3/lib

This will obviate the need to use LD_LIBRARY_PATH, which has some
controversy surrounding it's use. I also found a strangeness for the
install of DBD. If I remember correctly, the install document states
that LD_LIBRARY_PATH should be set during the module install, which
will link the value of the LD_LIBRARY_PATH . Indeed the value ends up
in the make file (in the EXTRA_LIBS, LD_RUN_PATH and OTHERLDFLAGS
entries), and the library seems to be available as per the ldd
command, yet, without either an LD_LIBRARY_PATH environment variable
or the ld.so.conf.d method, DBD does not run.

Any thoughts?
pg

Re: question for DBD-Oracle driver

am 09.04.2008 20:07:55 von mccullj

At 10:47 AM 4/9/2008, pgodfrin wrote:

>This will obviate the need to use LD_LIBRARY_PATH, which has some
>controversy surrounding it's use. I also found a strangeness for the
>install of DBD. If I remember correctly, the install document states
>that LD_LIBRARY_PATH should be set during the module install, which
>will link the value of the LD_LIBRARY_PATH . Indeed the value ends up
>in the make file (in the EXTRA_LIBS, LD_RUN_PATH and OTHERLDFLAGS
>entries), and the library seems to be available as per the ldd
>command, yet, without either an LD_LIBRARY_PATH environment variable
>or the ld.so.conf.d method, DBD does not run.
>
>Any thoughts?
>pg

I've just been through an install of DBD::Oracle on a Solaris 10
machine and this was my experience as well. My needs were
complicated by the fact that I was running it as a CGI script and
thus did not have a way to easily set an environment variable.

If you set LD_LIBRARY_PATH (or maybe LD_RUN_PATH) while doing the
module build, then Oracle.so will be compiled with the paths to the
modules it needs. But at runtime, it will load (on my system)
libclntsh.so.10.1 which it finds in the oracle instant client
directory. But then libclntsh.so.10.1 will want to load libnnz10.so
and will not be able to because libclntsh.so.10.1 was compiled with a
run path of whatever machine the Oracle client was compiled on. So
what I wound up doing was just symlinking libnnz10.so to /usr/lib and
I could then get my script to run without any runtime load paths.

Hope this helps...

Jim McCullars
University of Alabama in Huntsville

Re: question for DBD-Oracle driver

am 09.04.2008 22:03:16 von pgodfrin

On Apr 9, 1:07 pm, mccu...@email.uah.edu (James H. McCullars) wrote:
> At 10:47 AM 4/9/2008, pgodfrin wrote:
>
> >This will obviate the need to use LD_LIBRARY_PATH, which has some
> >controversy surrounding it's use. I also found a strangeness for the
> >install of DBD. If I remember correctly, the install document states
> >that LD_LIBRARY_PATH should be set during the module install, which
> >will link the value of the LD_LIBRARY_PATH . Indeed the value ends up
> >in the make file (in the EXTRA_LIBS, LD_RUN_PATH and OTHERLDFLAGS
> >entries), and the library seems to be available as per the ldd
> >command, yet, without either an LD_LIBRARY_PATH environment variable
> >or the ld.so.conf.d method, DBD does not run.
>
> >Any thoughts?
> >pg
>
> I've just been through an install of DBD::Oracle on a Solaris 10
> machine and this was my experience as well. My needs were
> complicated by the fact that I was running it as a CGI script and
> thus did not have a way to easily set an environment variable.
>
> If you set LD_LIBRARY_PATH (or maybe LD_RUN_PATH) while doing the
> module build, then Oracle.so will be compiled with the paths to the
> modules it needs. But at runtime, it will load (on my system)
> libclntsh.so.10.1 which it finds in the oracle instant client
> directory. But then libclntsh.so.10.1 will want to load libnnz10.so
> and will not be able to because libclntsh.so.10.1 was compiled with a
> run path of whatever machine the Oracle client was compiled on. So
> what I wound up doing was just symlinking libnnz10.so to /usr/lib and
> I could then get my script to run without any runtime load paths.
>
> Hope this helps...
>
> Jim McCullars
> University of Alabama in Huntsville

hmmm - running ldd on libclntsh.so gives me this:


linux-gate.so.1 => (0x00110000)
libnnz10.so => /oracle/product/10.2.0.3/lib/libnnz10.so (0x00111000)
libdl.so.2 => /lib/libdl.so.2 (0x00317000)
libm.so.6 => /lib/libm.so.6 (0x0031c000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00345000)
libnsl.so.1 => /lib/libnsl.so.1 (0x0035e000)
libc.so.6 => /lib/libc.so.6 (0x00377000)
/lib/ld-linux.so.2 (0x00687000)

I'm running a Fedora 8 box - 10.2.0.3 Oracle install...

pg

Re: question for DBD-Oracle driver

am 10.04.2008 09:17:10 von hjp

--b5gNqxB1S1yM7hjW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2008-04-09 13:07:55 -0500, James H. McCullars wrote:
> At 10:47 AM 4/9/2008, pgodfrin wrote:
>=20
> >This will obviate the need to use LD_LIBRARY_PATH, which has some
> >controversy surrounding it's use. I also found a strangeness for the
> >install of DBD. If I remember correctly, the install document states
> >that LD_LIBRARY_PATH should be set during the module install, which
> >will link the value of the LD_LIBRARY_PATH . Indeed the value ends up
> >in the make file (in the EXTRA_LIBS, LD_RUN_PATH and OTHERLDFLAGS
> >entries), and the library seems to be available as per the ldd
> >command, yet, without either an LD_LIBRARY_PATH environment variable
> >or the ld.so.conf.d method, DBD does not run.
>=20
> I've just been through an install of DBD::Oracle on a Solaris 10 machi=
ne and=20
> this was my experience as well. My needs were complicated by the fact th=
at I=20
> was running it as a CGI script and thus did not have a way to easily set =
an=20
> environment variable.

$ENV{LD_LIBRARY_PATH} =3D ...;

or somewhat more generic:

if (open(E, "$offl_root/dbi/env")) {
while () {=20
chomp;
my ($k, $v) =3D split(/=3D/);
$ENV{$k} =3D $v;
}
close(E);
}

hp

--=20
_ | Peter J. Holzer | If I wanted to be "academically correct",
|_|_) | Sysadmin WSR | I'd be programming in Java.
| | | hjp@wsr.ac.at | I don't, and I'm not.
__/ | http://www.hjp.at/ | -- Jesse Erlbaum on dbi-users

--b5gNqxB1S1yM7hjW
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFH/b72MdFfQa64PCwRAnBXAJ4+n5KbwCCXsuf+OfZ4Ie6KzuSg3QCg kBun
TI9yafCLRnjohpF3biSE7D0=
=XUSM
-----END PGP SIGNATURE-----

--b5gNqxB1S1yM7hjW--

Re: question for DBD-Oracle driver

am 10.04.2008 15:27:06 von mccullj

At 02:17 AM 4/10/2008, Peter J. Holzer wrote:
> > I've just been through an install of DBD::Oracle on a Solaris
> 10 machine and
> > this was my experience as well. My needs were complicated by the
> fact that I
> > was running it as a CGI script and thus did not have a way to
> easily set an
> > environment variable.
>
>$ENV{LD_LIBRARY_PATH} = ...;

That doesn't work from a CGI script.

Jim McCullars
University of Alabama in Huntsville

Re: question for DBD-Oracle driver

am 10.04.2008 16:08:34 von hjp

--nFBW6CQlri5Qm8JQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2008-04-10 08:27:06 -0500, James H. McCullars wrote:
> At 02:17 AM 4/10/2008, Peter J. Holzer wrote:
> >>I've just been through an install of DBD::Oracle on a Solaris 10
> >>machine and this was my experience as well. My needs were
> >>complicated by the fact that I was running it as a CGI script and
> >>thus did not have a way to easily set an environment variable.
> >
> >$ENV{LD_LIBRARY_PATH} =3D ...;
>=20
> That doesn't work from a CGI script.

Yes, it does. I have quite a few CGI scripts which use this technique.=20

Why shouldn't it work with a CGI script? I can think of reasons why it
wouldn't work with mod_perl, but none for a CGI script.

hp

--=20
_ | Peter J. Holzer | If I wanted to be "academically correct",
|_|_) | Sysadmin WSR | I'd be programming in Java.
| | | hjp@wsr.ac.at | I don't, and I'm not.
__/ | http://www.hjp.at/ | -- Jesse Erlbaum on dbi-users

--nFBW6CQlri5Qm8JQ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFH/h9iMdFfQa64PCwRAo7tAJ9yS4QMD5z8zWGvUponbv5DoFT/dwCf f0PK
LCGGC9YOE+1JUXDHBurB6oU=
=B/z5
-----END PGP SIGNATURE-----

--nFBW6CQlri5Qm8JQ--

Re: question for DBD-Oracle driver

am 10.04.2008 17:26:50 von mccullj

At 09:08 AM 4/10/2008, Peter J. Holzer wrote:

>Why shouldn't it work with a CGI script? I can think of reasons why it
>wouldn't work with mod_perl, but none for a CGI script.

Setting the environment variable worked for me from the command
line but never from a CGI script. The best explanation I could find
for this was here:

http://www.perlmonks.org/?node_id=126575

Since I didn't really want to fork a child process with every
script execution, I just symlinked the library into /usr/lib. Problem solved.

Jim McCullars
University of Alabama in Huntsville

Re: question for DBD-Oracle driver

am 10.04.2008 18:14:58 von hjp

--SdaPbLtAangIkrMZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2008-04-10 10:26:50 -0500, James H. McCullars wrote:
> At 09:08 AM 4/10/2008, Peter J. Holzer wrote:
> >Why shouldn't it work with a CGI script? I can think of reasons why it
> >wouldn't work with mod_perl, but none for a CGI script.
>=20
> Setting the environment variable worked for me from the command line bu=
t=20
> never from a CGI script.

By "worked for me from the command line" do mean:

1) Set the environment variable within the script as in the example I
gave and invoked the script from the command line, or

2) set the environment variable in the shell and then invoke the script?

These are completely different.=20

> The best explanation I could find for this was here:
>=20
> http://www.perlmonks.org/?node_id=3D126575

This talks about the second case. Yes, that's entirely possible (doesn't
seem to be the case on linux, though), but it doesn't have anything to
do with CGI scripts.

I don't believe that that the first case is possible on any unixoid OS.

hp

--=20
_ | Peter J. Holzer | If I wanted to be "academically correct",
|_|_) | Sysadmin WSR | I'd be programming in Java.
| | | hjp@wsr.ac.at | I don't, and I'm not.
__/ | http://www.hjp.at/ | -- Jesse Erlbaum on dbi-users

--SdaPbLtAangIkrMZ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFH/j0CMdFfQa64PCwRAudWAKCUxzCxFbLDOov/HxGqM8IaBk79tQCg mjAY
Nf1BqRvp9aDaHuSiNZdUznM=
=sJED
-----END PGP SIGNATURE-----

--SdaPbLtAangIkrMZ--