I don't have an example for Sybase, but I have done this sort of thing with
a couple of local and remote Oracles as well as multiple local Oracles.
Basically, you connect to each one as you would expect and assign a
different handle to each connection.  From there on, it doesn't matter
whether they're local or remote since everything is done via DBI, which
nicely insulates you from such headaches. :)

A scrap of code:
-----8<-----
#!/usr/local/bin/perl

use DBI;

my $sid1='PCUS';
my $username1='pcus_username';
my $password1='pcus_password1;

my $sid2='SDI';
my $username2='sdi_username';
my $password2='pinecone';

END { 
    $dbh1->disconnect();
    $dbh2->disconnect();
}

$dbh1=DBI->connect("dbi:Oracle:".$sid1,$username1,$password1,{AutoCommit=>0}
) || die "Can't connect to database $s
id1:",$DBI::errstr,"\n";
$dbh2=DBI->connect("dbi:Oracle:".$sid2,$username2,$password2,{AutoCommit=>0}
) || die "Can't connect to database $s
id2:",$DBI::errstr,"\n";
-----8<-----

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 02, 2001 3:27 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: accessing sybase & oracle simultaneously



Does anyone have a sample code which demonstrates
using DBI to access both a remote oracle and local
sybase servers simultaneously?

Goal is to connect & perform same operations 
(insert & select & delete) on both databases.  From a 
code level perspective, each insert
and update must in affect be performed twice ( once 
for each datastore oracle/sybase). This would render
the databases equal in terms of information added
& and removed.

I have an idea of how I might try it but wanted to 
know if anyone had done it or knows exactly how,
caveats, etc.  The oracle queries would be to a
remote host while the sybase queries would be on 
the local host.

TIA!

TIA

Reply via email to