Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: Multiple file handles

by 1nickt (Canon)
on Apr 08, 2023 at 10:41 UTC ( [id://11151539]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Multiple file handles
in thread Multiple file handles

DBI is the plumbing; DBD::mysql is the fitting. You need both.

From the doc for DBD::mysql (plus your error handling):

my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port"; my $dbh = DBI->connect($dsn, $user, $password) or die "Couldn't connec +t to database: ".DBI->errstr;
Set up all those variables then use that exact code snippet and it should work for you.

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^5: Multiple file handles
by MoodyDreams999 (Beadle) on Apr 13, 2023 at 17:26 UTC
    Yeah, that helped alot, I was trying to find an example where they use the dsn in the connect statement, wasn't sure I was doing it right since it kept failing, probably just need to make sure its got the right credentials since we have like 5 different servers for similar things.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-06-21 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.