Solved

Perl DBI Pooling

Posted on 2013-06-19
6
376 Views
Last Modified: 2013-12-25
http://search.cpan.org/~timb/DBI-1.627/DBI.pm

When using this, is some kind of reuse of database connections implemented automatically, or database pooling of some sort? I did a quick search for the word pool, and found a dead link to http://search.cpan.org/perldoc?DBI%3A%3APool
0
Comment
Question by:itnifl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 90 total points
ID: 39261568
If there is, it would have to be implemented in the drivers.  DBI depends on the drivers for things like that.  Two different databases would not have the same driver and protocol so you couldn't pool them but you could still connect to both of them in the same program using DBI.

http://search.cpan.org/~timb/DBI-1.627/DBI.pm#connect
0
 
LVL 2

Author Comment

by:itnifl
ID: 39261596
Yes, I forgot to mention that I am connecting to mysql.
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 90 total points
ID: 39261609
You'd have to look at the MySQL driver for any connection pooling.  It's not going to be in DBI itself because DBI is a standardized interface for many databases.  Here's the page for the MySQL driver: http://search.cpan.org/dist/DBD-mysql/
0
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 
LVL 2

Author Comment

by:itnifl
ID: 39261644
I know when connecting to mysql with C# I set up connection pooling in the connection string. I guess that might have been specific for the drivers C# uses? I'll take a look at your link :)
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 90 total points
ID: 39263273
I believe that in C# you are going directly to the driver.  DBI does not provide for that.  DBI is an interface between your program and the driver.
0
 
LVL 26

Accepted Solution

by:
wilcoxon earned 410 total points
ID: 39263584
If DBD::mysql does not provide connection pooling (most DBD drivers I've looked at don't) then it is pretty easy to write it yourself.

DBI does provide connect_cached which may solve your issue directly within DBI.

In general, unless you have a very long-running program (or something that acts as a daemon), it is sufficient to open the connection when the program starts and let it auto-close when the program ends.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Deploy restore partition 1 55
Powershell Split 18 43
-OutVariable to Global 1 33
Move files based on file names? 8 68
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question