Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Is it possible to connect to multiple DBI servers in a single connection string?

by valavanp (Curate)
on Jun 17, 2006 at 14:32 UTC ( [id://555964]=perlquestion: print w/replies, xml ) Need Help??

valavanp has asked for the wisdom of the Perl Monks concerning the following question:

if i want to connect two dbd drivers A and B in a single connection string, how to go for it. Is it possible.

2006-06-17 Retitled by g0n, as per Monastery guidelines
Original title: 'perl DBI'

Replies are listed 'Best First'.
Re: Is it possible to connect to multiple DBI servers in a single connection string?
by davidrw (Prior) on Jun 17, 2006 at 14:40 UTC
    why? what database(s)? no, you can't do that (how would it work??).. but you can just open two connections and work with each of them:
    my $dbhA = DBI->connect($data_sourceA, $usernameA, $authA, \%attrA) +or die ...; my $dbhB = DBI->connect($data_sourceB, $usernameB, $authB, \%attrB) +or die ...;
    If you're trying to do cross-db joins or something, you'll have to do it in perl (or move all the data into one or the other, or a 3rd temp database).
    If you're just copying code from one to the other, try DBIx::Copy as well as Super Search for lots of related threads.
Re: Is it possible to connect to multiple DBI servers in a single connection string?
by tantarbobus (Hermit) on Jun 17, 2006 at 15:52 UTC
    Take a look at DBD::Multiplex
Re: Is it possible to connect to multiple DBI servers in a single connection string?
by dragonchild (Archbishop) on Jun 17, 2006 at 20:40 UTC
    DBD::Multiplex is definitely what you're looking for.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: Is it possible to connect to multiple DBI servers in a single connection string?
by gellyfish (Monsignor) on Jun 17, 2006 at 14:41 UTC

    Quite simply, no. I think you had better explain why you might want to do this, as I for one can't actually think of any sensible use for such a facility.

    If you want to mirror data updates across more than one database then you probably want to be doing this at the database server level rather than your application code.

    /J\

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://555964]
Approved by wfsp
Front-paged by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-29 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found