Solved

Perl DBI Pooling

Posted on 2013-06-19
6
358 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 82

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 82

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 82

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now