Solved

Perl DBI Pooling

Posted on 2013-06-19
6
385 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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

636 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