Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: database connection output

by themage (Friar)
on Nov 30, 2006 at 16:53 UTC ( #587006=note: print w/replies, xml ) Need Help??


in reply to database connection output

hi dreman,

All you need is to create two diferent $dbhs. Example:
my $dbh1=DBI->connect("dbi:Sybase:$server1","$user1", "$pass1" ) or di +e DBI::errstr; my $dbh2=DBI->connect("dbi:Sybase:$server2","$user2", "$pass2" ) or di +e DBI::errstr; $dbh1->do("SOME SQL ON SERVER 1"); $dbh2->do("SOME SQL ON SERVER 2");
It was not that hard, was it? Wasn't this a ask first, think later question?

TheMage
Talking Web

Replies are listed 'Best First'.
Re: database connection output
by jonadab (Parson) on Nov 30, 2006 at 17:12 UTC
    Wasn't this a ask first, think later question?

    Given that his variables names are $dbh and $sth and so on, it may be that he is coding by copy-and-paste and may not fully understand what a DBI handle is.


    Sanity? Oh, yeah, I've got all kinds of sanity. In fact, I've developed whole new kinds of sanity. You can just call me "Mister Sanity". Why, I've got so much sanity it's driving me crazy.
Re^2: database connection output
by davorg (Chancellor) on Dec 01, 2006 at 08:58 UTC
    All you need is to create two diferent $dbhs

    Am I missing something here? It looks to me as tho' he _is_ creating two different database handles. The $dbh variable is lexically scoped to the &SQL subroutine so a new one is created each time the subroutine is called.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://587006]
help
Chatterbox?
[Eily]: let me inform you that the Dutch reek translate into the Czech páchnout
[Eily]: very useful default translation :P
[Eily]: BTW LanX, you should try typing a few random chars at the beginning of each message. This will prevent expansion :P
[LanX]: qwiud you sthink so?
[LanX]: zxwqbd good idea! :)
LanX embraces his new habit spqopiwjdnq
[ambrus]: qQUkZTmHTuKxStGT- BzTIK9gdudif7TkTLI t3mnF144UaAZjkknXY 8nN-QM19wHBsTrp5vB lEYU_Kksa7X1RIBB4x EWLD5X7SW3jGX5ryfN OMn_yL5FTdQxzjhtyX mKN9sjUCzBNHK5Rrp0 S2WMUvIb1i9aZFgjtq VR0GH1bjPMvm1G16iz hBqc1U6toPd4FbJOFj VsOeT745AN1_pO88rD SRAYKtBZwCZedESZmN mvutrOTHiSNwflB- pRfn_k
[Eily]: so far it seems to work
Your Mother reminds the monks they should be grateful not to share an office, lest they be subjugated to constant inanities like, "Czech please!"
[LanX]: what's strange is that the "Cowboy you said this already" message is missing #dqiwd

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2017-03-27 16:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.