Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Connecting to 2 mysql database in one script

by jfroebe (Parson)
on Nov 21, 2008 at 22:31 UTC ( [id://725246]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $dbh1 = DBI->connect($DSN,$sqluser,$sqlpass)
        || die "Cannot connect: $DBI::errstr\n" unless $dbh1;
    $dbh2 = DBI->connect($DSN2,$sqluser2,$sqlpass2)
        || die "Cannot connect: $DBI::errstr\n" unless $dbh2;
    
  2. or download this
    sub my_query {
      my $my_dbh = shift;
      my $query = shift;
    ...
    }
    
    my_query($dbh1, "select * from potatoes");
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://725246]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-19 03:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found