Great. Glad it works for you!
jeff wrote:
Thank you, Scott !
In case anyone else needs this sort of setup: I wanted to share this
quick & dirty & successful test using Scott's RMI to connect to both
oracle 10 with a wallet and oracle 8 with external authentication - no
user names or passwords provided in script.
ora8_lib contains the Oracle DBD for oracle 8 and only the forked server
sees it. ld_library_path is also set to pick up both oracle clients.
And prepare returns the query info as well - which is why proxyserver
didn't work for me.
looking very good so far !
############################################################################
use RMI::Client::ForkedPipes;
use DBI;
$c = RMI::Client::ForkedPipes->new();
$c->call_use('DBI');
my $paths = $c->call_eval('@main::x = @INC; return \...@main::x;');
foreach my $path (@{$paths}) {
print "$path\n";
}
print "============================\n";
$c->call_use_lib('/home/owuser1/perl58/perl_ora10/ora8_lib'); # A build
of Oracle DBD using oracle 8 client
my $paths = $c->call_eval('@main::x = @INC; return \...@main::x;');
foreach my $path (@{$paths}) {
print "$path\n";
}
print "============================\n";
############################################################################
$remote_dbh =
$c->call_class_method('DBI','connect',"dbi:Oracle:OWSERV1",'','');
print "$remote_dbh\n";
if (defined $remote_dbh) {
my $sth = $remote_dbh->prepare("select
sys_context('userenv','session_user') from dual");
foreach my $name (@{$sth->{NAME}}) {
print "\t$name\n";
}
$sth->execute;
print $sth->fetch;
print " OK :) Oracle8\n";
} else {
print "No Connection Oracle8\n";
}
$remote_dbh->disconnect;
############################################################################
my $db3=DBI->connect("dbi:Oracle:OWSERV2",'','');
print "$db3\n";
if (defined $db3) {
my $sth = $db3->prepare("select sys_context('userenv','session_user')
from dual");
foreach my $name (@{$sth->{NAME}}) {
print "\t$name\n";
}
$sth->execute;
print $sth->fetch;
print " OK :) Oracle10\n";
} else {
print "No Connection Oracle10\n";
}
$db3->disconnect;
############################################################################
$remote_dbh =
$c->call_class_method('DBI','connect',"dbi:Oracle:OWSERV1",'','');
print "$remote_dbh\n";
if (defined $remote_dbh) {
my $sth = $remote_dbh->prepare("select
sys_context('userenv','session_user') from dual");
foreach my $name (@{$sth->{NAME}}) {
print "\t$name\n";
}
$sth->execute;
print $sth->fetch;
print " OK :) Oracle8\n";
} else {
print "No Connection Oracle8\n";
}
$remote_dbh->disconnect;
############################################################################
On Mon, 2009-12-14 at 20:09 -0600, Scott Smith wrote:
Try RMI::Client::ForkedPipes. Have the child process use one lib, and
the parent use the other. The child can give back with one DBI/DBD, and
the parent can produce handles from the other.
This is effectively the proxy solution, but you're just forking and
proxying to a private sub-process you created.
(Full disclosure: I wrote the RMI modules. If they break for you please
email me.)
Scott