Thanks for the input but perhaps the KEY criteria got lost in the
original post:

The script MUST connect to BOTH Oracle 8 and Oracle 10 WITHOUT
a username and password entered. From what I've seen a build on Oracle
10 will succeed ONLY with oracle 10 WITHOUT a user/password. The same
goes for Oracle 8.  

There is a difference between versions in this regard and this is why I
can not use the same client libraries.

Have tested and both DBDs DO succeed loading their respective libraries:
oracle. Here are the minimum install for LD_LIBRARY_PATH
libclntsh.so.10.1*  libnnz10.so*
oracle8:
libclntsh.so.8.0*  libwtc8.so  

And from what Ive seen it is LD_LIBRARY_PATH that allows the client libs
to be found - Not ORACLE_HOME. ORACLE_HOME is needed for tns_names.ora.

And I know there's no error checking, but please, lets not get hung up
on syntax - the examples are quick and dirty. ;-)

If can anyone successfully runs Alexander code when SERV1 is Oracle 8
and SERV2 is Oracle 10 - no username or password - PLEASE let me know
how its done.  

Its my understanding that Oracle 8 uses system login info and Oracle 10
uses a wallet. If anyone has built a DBD that accomplished this in both
versions PLEASE let me know how.

Thanks.  Any other solutions would be GREATLY appreciated.
;-)

On Wed, 2009-10-28 at 21:18 +0100, Alexander Foken wrote:
> On 28.10.2009 20:38, jeff wrote:
> > Hi all,
> >
> > Hope someone can help.
> >
> > I need to talk to both an oracle 8 and oracle 10 server in the same
> > script using their respective "external connections" capabilities (i.e.,
> > no user name or password  -- system authentication on 8 & wallet on
> > 10 ).
> >   
> Install the Oracle 10 Client libraries and let them handle the 
> connection to both Oracle 8 server and Oracle 10 server.  A difference 
> of "only" two major version numbers should be no problem for them. See 
> below.
> > Hacked up a version of DBD to get everything renamed from 'Oracle' to
> > 'Oracle8' and built against Oracle 8 libs. The other is built against
> > Oracle 10 libs.  So I've 2 different builds in the same perl build:
> >   
> Much, much unneeded pain that way.
> > I'm reading from a single tns_names.ora.
> > ( SERV2 is Oracle 10 & SERV1 is Oracle 8 )
> >   
> So, why don't you use the same client libs?
> > ORACLE_HOME is the same each time.
> >   
> That obviously can not work. If you have two sets of client libraries, 
> you need two different ORACLE_HOMEs.
> > LD_LIBRARY_PATH includes 2 entries - 1 for Oracle 10 lib directory 
> > and 1 for Oracle 8.
> >   
> So one of the DBDs will succed loading the libs, and the other will fail.
> > So the environment is the same every time.
> >   
> Sure, but it is broken.
> >
> > I can:
> > --------------------------------------------
> > use DBD::Oracle8;
> > my $db3=DBI->connect("dbi:Oracle8:SERV1",'','');
> > --------------------------------------------
> >   
> Wrong. You NEVER load the DBD manually, DBI does that for you. And your 
> code lacks the standard error check documented in the DBI documentation.
> > Or I can:
> > --------------------------------------------
> > use DBD::Oracle;
> > my $db3=DBI->connect("dbi:Oracle:SERV2",'','');
> > --------------------------------------------
> >   
> Wrong, as above.
> > but:
> > --------------------------------------------
> > use DBD::Oracle8;
> > use DBD::Oracle;
> >
> > my $db3=DBI->connect("dbi:Oracle8:SERV1",'','');
> > my $db3=DBI->connect("dbi:Oracle:SERV2",'','');
> > --------------------------------------------
> > Will make both connections successfully, but exits
> > with a segmentation fault
> >   
> Of course it segfaults, because one of the DBDs was compiled against 
> Oracle 8 client libs, and the other against Oracle 10 client libs, and 
> both attempt to load the same external libraries, because your 
> ORACLE_HOME is always wrong for one of the DBDs.
> 
> > Or if I reverse the connections:
> > --------------------------------------------
> > use DBD::Oracle8;
> > use DBD::Oracle;
> >
> > my $db3=DBI->connect("dbi:Oracle:SERV2",'','');
> > my $db3=DBI->connect("dbi:Oracle8:SERV1",'','');
> > --------------------------------------------
> > first connection succeeds and second fails.
> >   
> Sure. Same reason.
> >
> > Also, these obviously fail because of wrong Oracle version:
> > --------------------------------------------
> > use DBD::Oracle;
> > my $db3=DBI->connect("dbi:Oracle:SERV1",'','');
> > --------------------------------------------
> > --------------------------------------------
> > use DBD::Oracle8;
> > my $db3=DBI->connect("dbi:Oracle8:SERV2",'','');
> > --------------------------------------------
> >
> > Any ideas as to why?  Thanks.
> >   
> Yes. Wrong way.
> 
> Get rid of all the files you created by torturing DBD::Oracle into your 
> DBD::Oracle8. Uninstall the Oracle 8 client. And to be sure, remove 
> DBD::Oracle and the Oracle 10 client, re-install the Oracle 10 client, 
> re-install an unmodified DBD::Oracle and compile it against the Oracle 
> 10 client.
> 
> This way, you will end with a single DBD::Oracle compiled against Oracle 
> 10 client, and all those binary code provided by Oracle, hidden in 
> several libraries, will take care of connecting to the Oracle 8 server.
> 
> Your Perl code will simply look like this:
> 
> #!/usr/bin/perl
> use warnings;
> use strict;
> use DBI;
> # no "use DBD::Oracle"!
> 
> my $ora8=DBI->connect('dbi:Oracle:SERV1','','') or die "Can't connect to 
> SERV1: $DBI::errstr";
> my $ora10=DBI->connect('dbi:Oracle:SERV2','','') or die "Can't connect 
> to SERV2: $DBI::errstr";
> 
> See also 
> <http://search.cpan.org/~pythian/DBD-Oracle-1.23/Oracle.pm#CONNECTING_TO_ORACLE>
>  
> and 
> <http://search.cpan.org/~pythian/DBD-Oracle-1.23/Oracle.pm#CONNECTING_TO_ORACLE_II>
>  
> for a long discussions of all the strange ways you can use to connect to 
> Oracle.
> 
> Alexander
> 

Reply via email to