in reply to connecting toOracle7 and Oracle9 simultaneously

From DBI DBD::Oracle and OraPerl FAQ:

"This example connects to two databases simultaneously:"
use strict; use DBI; my $dbh1 = DBI->connect( "dbi:Oracle:ORCL1", "scott", "tiger" ) or die + "Can't connect to 1st Oracle database: $DBI::errstr\n"; my $dbh2 = DBI->connect( "dbi:Oracle:ORCL2", "scott", "tiger" ) or die + "Can't connect to 2nd Oracle database: $DBI::errstr\n"; $dbh1->disconnect or warn "DB1 disconnection failed: $DBI::errstr\n"; $dbh2->disconnect or warn "DB2 disconnection failed: $DBI::errstr\n";

Replies are listed 'Best First'.
Re^2: connecting toOracle7 and Oracle9 simultaneously
by dragonchild (Archbishop) on Jun 03, 2005 at 15:40 UTC
    Unfortunately, the problem is connecting to two different database versions with the same DBD::Oracle, which isn't so easy. The problem is that DBD::Oracle compiles against a specific OCI. The OCIs for Ora7 and Ora9 are very different.

    I'm emailed Tim Bunce (the author of both DBI and DBD::Oracle) informing him of this thread. Hopefully, he will have time to respond.


    • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
    • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"

      Disclamer: I haven't tried this with DBD::Oracle so I could be all wet.

      At work we regularly connect to oracle databases of one version using clients of a different version (i.e. connecting to a 9i or 10g database using an 8 client). The only issue that I seem to recall was trying to access new 8i functionality with an older (7.2 I think) client.

      As for which clients should work with which databases, there's a "Oracle Client / Server Interoperability Support" matrix out on the Oracle metalink site. Additionally, this note may also help clarify the OCI question a bit.

      Hope that helps.

        The links only help those of us who have accounts on metalink, which is only available to people who know their company's support contract info with Oracle. (and I don't currently work for a company with a CSI)

        I've used 9.2 client to connect to an 8.1 database, and an 8.1 client to connect to a 7.3.4? (was 7, definately... for some reason, 7.3.4 comes to mind), and I know there are settings in the server so that you can allow older versions of the client to connect, but I don't know how severe the penalty is for doing it in 9.2

Re^2: connecting toOracle7 and Oracle9 simultaneously
by Fletch (Bishop) on Jun 03, 2005 at 15:45 UTC

    That connects to two databases, but it uses the same DBD::Oracle to to it. The OP's problem is that they've got one old and one new that'd (presumably) need two different compiles of DBD::Oracle to talk. This solution might work, but only if v9 is backwards compatible and able to talk to the older v7 instance.

    If that's not the case (i.e. v9 can't talk to a v7 DB; I don't know, I'm not an Oracle person):

    • Compile DBD::Oracle against v9 (setting ORAHOME et al to point at that)
    • Compile it again against v7, but pass a different PREFIX setting when you run perl Makefile.PL
    • write one script that does a use lib to point to where you installed the v7 DBD::Oracle and does whatever you need there and saves the results to an intermediary file
    • write a second script that uses the v9 DBD::Oracle in the default path to process the results from the first

    If you can't separate things into two programs (you need to consult the v9 database to know what you need from the v7 DB or what not) things get much more harry. In that case you might could use something like RPC::XML and write a server which provides results from one DB and the main program connects to the other DB and calls across to that XML-RPC server as needed.

    Update: Oop, looks like it is the case that they're not compatible by the above post. Looks like you're in harry land.

    --
    We're looking for people in ATL