Free Books / Computers / Practical mod_perl / books


previous page: 20.1. Persistent Database Connections with Apache::DBIpage up: Practical mod_perl | by Stas Bekman and Eric Choletnext page: 20.1.2. When to Use Apache::DBI (and When Not to Use It)

20.1.1. Apache::DBI Connections

Search

Titles
  • Animals
  • Architecture
  • Arts
  • Business
  • Computers
  • Crafts
  • Finance
  • Flora and Plants
  • Cooking
  • Gardening
  • Health and Healing
  • History
  • Home Improvements
  • Languages
  • New Age
  • Novels
  • Real Estate
  • Reference
  • Religion
  • Science
  • Society
  • Sports
  • Travel
  • Outdoors
  • Site Listing

Discover
  • Find Articles
  • FAQ Help Tutorials























Description

This section is from the "Practical mod_perl" book, by Stas Bekman and Eric Cholet. Also available from Amazon: Practical mod_perl

The DBI module can make use of the Apache::DBI module. When the DBI module loads, it tests whether the environment variable $ENV{MOD_PERL} is set and whether the Apache::DBI module has already been loaded. If so, the DBI module forwards every connect( ) request to the Apache::DBI module.

When Apache::DBI gets a connect( ) request, it checks whether it already has a handle with the same connect( ) arguments. If it finds one, it checks that the connection is still valid using the ping( ) method. If this operation succeeds, the database handle is returned immediately. If there is no appropriate database handle, or if the ping( ) method fails, Apache::DBI establishes a new connection, stores the handle, and then returns the handle to the caller.

It is important to understand that the pool of connections is not shared between the processes. Each process has its own pool of connections.

When you start using Apache::DBI, there is no need to delete all the disconnect( )statements from your code. They won't do anything, because the Apache::DBI module overloads the disconnect( ) method with an empty one. You shouldn't modify your scripts at all for use with Apache::DBI.

 

Continue to:

  • prev: 20.1. Persistent Database Connections with Apache::DBI
  • Table of Contents
  • next: 20.1.2. When to Use Apache::DBI (and When Not to Use It)

Books by Stas Bekman:

Tags

practical mod_perl, modperl, Apache, perl, cgi, html, scalability, free, open source, OSS, squid, high availability, linux, unix, web, www, webserver, admin, book, webmaster, tools, modperl guide, docs, documentation, help, script, eric cholet, stas bekman, performance, speed, choice









TOP
previous page: 20.1. Persistent Database Connections with Apache::DBIpage up: Practical mod_perl | by Stas Bekman and Eric Choletnext page: 20.1.2. When to Use Apache::DBI (and When Not to Use It)

© 2007 StasoSphere

[ Privacy Policy ] [ Terms of Use ] [ About Us ] [ Search ]

Last modified Mon Oct 20 15:54:29 2008