Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Perl DBI Pooling

Posted on 2013-06-19
6
Medium Priority
?
425 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
  • 3
  • 2
6 Comments
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 360 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 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 360 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 360 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 27

Accepted Solution

by:
wilcoxon earned 1640 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

916 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