home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / apache_2.2.8-win32-x86-no_ssl.msi / Data1.cab / _C948E1C7A831C0F44F001EB2E7389A19 < prev    next >
Extensible Markup Language  |  2007-09-09  |  17KB  |  270 lines

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
  4.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  5.               This file is generated from xml source: DO NOT EDIT
  6.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  7.       -->
  8. <title>mod_dbd - Apache HTTP Server</title>
  9. <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
  10. <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
  11. <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
  12. <link href="../images/favicon.ico" rel="shortcut icon" /></head>
  13. <body>
  14. <div id="page-header">
  15. <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
  16. <p class="apache">Apache HTTP Server Version 2.2</p>
  17. <img alt="" src="../images/feather.gif" /></div>
  18. <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
  19. <div id="path">
  20. <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.2</a> > <a href="./">Modules</a></div>
  21. <div id="page-content">
  22. <div id="preamble"><h1>Apache Module mod_dbd</h1>
  23. <div class="toplang">
  24. <p><span>Available Languages: </span><a href="../en/mod/mod_dbd.html" title="English"> en </a></p>
  25. </div>
  26. <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Manages SQL database connections</td></tr>
  27. <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  28. <tr><th><a href="module-dict.html#ModuleIdentifier">ModuleáIdentifier:</a></th><td>dbd_module</td></tr>
  29. <tr><th><a href="module-dict.html#SourceFile">SourceáFile:</a></th><td>mod_dbd.c</td></tr>
  30. <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.1 and later</td></tr></table>
  31. <h3>Summary</h3>
  32.  
  33.     <p><code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code> manages SQL database connections using
  34.     <a href="http://people.apache.org/~niq/dbd.html">apr_dbd</a>.
  35.     It provides database connections on request to modules
  36.     requiring SQL database functions, and takes care of
  37.     managing databases with optimal efficiency and scalability
  38.     for both threaded and non-threaded MPMs.</p>
  39. </div>
  40. <div id="quickview"><h3 class="directives">Directives</h3>
  41. <ul id="toc">
  42. <li><img alt="" src="../images/down.gif" /> <a href="#dbdexptime">DBDExptime</a></li>
  43. <li><img alt="" src="../images/down.gif" /> <a href="#dbdkeep">DBDKeep</a></li>
  44. <li><img alt="" src="../images/down.gif" /> <a href="#dbdmax">DBDMax</a></li>
  45. <li><img alt="" src="../images/down.gif" /> <a href="#dbdmin">DBDMin</a></li>
  46. <li><img alt="" src="../images/down.gif" /> <a href="#dbdparams">DBDParams</a></li>
  47. <li><img alt="" src="../images/down.gif" /> <a href="#dbdpersist">DBDPersist</a></li>
  48. <li><img alt="" src="../images/down.gif" /> <a href="#dbdpreparesql">DBDPrepareSQL</a></li>
  49. <li><img alt="" src="../images/down.gif" /> <a href="#dbdriver">DBDriver</a></li>
  50. </ul>
  51. <h3>Topics</h3>
  52. <ul id="topics">
  53. <li><img alt="" src="../images/down.gif" /> <a href="#pooling">Connection Pooling</a></li>
  54. <li><img alt="" src="../images/down.gif" /> <a href="#API">Apache DBD API</a></li>
  55. <li><img alt="" src="../images/down.gif" /> <a href="#prepared">SQL Prepared Statements</a></li>
  56. </ul><h3>See also</h3>
  57. <ul class="seealso">
  58. <li><a href="../misc/password_encryptions.html">Password Formats</a></li>
  59. </ul></div>
  60. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  61. <div class="section">
  62. <h2><a name="pooling" id="pooling">Connection Pooling</a></h2>
  63.     <p>This module manages database connections, in a manner
  64.     optimised for the platform.  On non-threaded platforms,
  65.     it provides a persistent connection in the manner of
  66.     classic LAMP (Linux, Apache, Mysql, Perl/PHP/Python).
  67.     On threaded platform, it provides an altogether more
  68.     scalable and efficient <em>connection pool</em>, as
  69.     described in <a href="http://www.apachetutor.org/dev/reslist">this article at ApacheTutor</a>. <code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code> supersedes
  70.     the modules presented in that article.</p>
  71. </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  72. <div class="section">
  73. <h2><a name="API" id="API">Apache DBD API</a></h2>
  74.     <p><code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code> exports five functions for other modules
  75.     to use. The API is as follows:</p>
  76.  
  77.     <div class="example"><pre><code>typedef struct {
  78.     apr_dbd_t *handle;
  79.     apr_dbd_driver_t *driver;
  80.     apr_hash_t *prepared;
  81. } ap_dbd_t;
  82.  
  83. /* Export functions to access the database */
  84.  
  85. /* acquire a connection that MUST be explicitly closed.
  86.  * Returns NULL on error
  87.  */
  88. AP_DECLARE(ap_dbd_t*) ap_dbd_open(apr_pool_t*, server_rec*);
  89.  
  90. /* release a connection acquired with ap_dbd_open */
  91. AP_DECLARE(void) ap_dbd_close(server_rec*, ap_dbd_t*);
  92.  
  93. /* acquire a connection that will have the lifetime of a request
  94.  * and MUST NOT be explicitly closed.  Return NULL on error.
  95.  * This is the preferred function for most applications.
  96.  */
  97. AP_DECLARE(ap_dbd_t*) ap_dbd_acquire(request_rec*);
  98.  
  99. /* acquire a connection that will have the lifetime of a connection
  100.  * and MUST NOT be explicitly closed.  Return NULL on error.
  101.  */
  102. AP_DECLARE(ap_dbd_t*) ap_dbd_cacquire(request_rec*);
  103.  
  104. /* Prepare a statement for use by a client module */
  105. AP_DECLARE(void) ap_dbd_prepare(server_rec*, const char*, const char*);
  106.  
  107. /* Also export them as optional functions for modules that prefer it */
  108. APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_open, (apr_pool_t*, server_rec*));
  109. APR_DECLARE_OPTIONAL_FN(void, ap_dbd_close, (server_rec*, ap_dbd_t*));
  110. APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_acquire, (request_rec*));
  111. APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_cacquire, (conn_rec*));
  112. APR_DECLARE_OPTIONAL_FN(void, ap_dbd_prepare, (server_rec*, const char*, const char*));
  113. </code></pre></div>
  114. </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  115. <div class="section">
  116. <h2><a name="prepared" id="prepared">SQL Prepared Statements</a></h2>
  117.     <p><code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code> supports SQL prepared statements on behalf
  118.     of modules that may wish to use them.  Each prepared statement
  119.     must be assigned a name (label), and they are stored in a hash:
  120.     the <code>prepared</code> field of an <code>ap_dbd_t</code>.
  121.     Hash entries are of type <code>apr_dbd_prepared_t</code>
  122.     and can be used in any of the apr_dbd prepared statement
  123.     SQL query or select commands.</p>
  124.  
  125.     <p>It is up to dbd user modules to use the prepared statements
  126.     and document what statements can be specified in httpd.conf,
  127.     or to provide their own directives and use <code>ap_dbd_prepare</code>.</p>
  128. </div>
  129. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  130. <div class="directive-section"><h2><a name="DBDExptime" id="DBDExptime">DBDExptime</a> <a name="dbdexptime" id="dbdexptime">Directive</a></h2>
  131. <table class="directive">
  132. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Keepalive time for idle connections</td></tr>
  133. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDExptime <var>time-in-seconds</var></code></td></tr>
  134. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  135. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  136. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
  137. </table>
  138.     <p>Set the time to keep idle connections alive where the number
  139.     of connections specified in DBDKeep has been exceeded (threaded
  140.     platforms only).</p>
  141.  
  142. </div>
  143. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  144. <div class="directive-section"><h2><a name="DBDKeep" id="DBDKeep">DBDKeep</a> <a name="dbdkeep" id="dbdkeep">Directive</a></h2>
  145. <table class="directive">
  146. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum sustained number of connections</td></tr>
  147. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDKeep <var>number</var></code></td></tr>
  148. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  149. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  150. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
  151. </table>
  152.     <p>Set the maximum number of connections per process to be
  153.     sustained, other than for handling peak demand (threaded
  154.     platforms only).</p>
  155.  
  156. </div>
  157. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  158. <div class="directive-section"><h2><a name="DBDMax" id="DBDMax">DBDMax</a> <a name="dbdmax" id="dbdmax">Directive</a></h2>
  159. <table class="directive">
  160. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of connections</td></tr>
  161. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDMax <var>number</var></code></td></tr>
  162. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  163. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  164. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
  165. </table>
  166.     <p>Set the hard maximum number of connections per process
  167.     (threaded platforms only).</p>
  168.  
  169. </div>
  170. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  171. <div class="directive-section"><h2><a name="DBDMin" id="DBDMin">DBDMin</a> <a name="dbdmin" id="dbdmin">Directive</a></h2>
  172. <table class="directive">
  173. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of connections</td></tr>
  174. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDMin <var>number</var></code></td></tr>
  175. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  176. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  177. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
  178. </table>
  179.     <p>Set the minimum number of connections per process (threaded
  180.     platforms only).</p>
  181.  
  182. </div>
  183. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  184. <div class="directive-section"><h2><a name="DBDParams" id="DBDParams">DBDParams</a> <a name="dbdparams" id="dbdparams">Directive</a></h2>
  185. <table class="directive">
  186. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Parameters for database connection</td></tr>
  187. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDParams
  188. <var>param1</var>=<var>value1</var>[,<var>param2</var>=<var>value2</var>]</code></td></tr>
  189. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  190. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  191. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
  192. </table>
  193.     <p>As required by the underlying driver.  Typically this will be
  194.     used to pass whatever cannot be defaulted amongst username,
  195.     password, database name, hostname and port number for connection.</p>
  196.     <p>Connection string parameters for current drivers include:</p>
  197.     <dl>
  198.     <dt>MySQL</dt>
  199.     <dd>host, port, user, pass, dbname, sock</dd> 
  200.     <dt>Oracle</dt>
  201.     <dd>user, pass, dbname, server</dd> 
  202.     <dt>PostgreSQL</dt>
  203.     <dd>The connection string is passed straight through to <code>PQconnectdb</code></dd>
  204.     <dt>SQLite2</dt>
  205.     <dd>The connection string is split on a colon, and <code>part1:part2</code> is used as <code>sqlite_open(part1, atoi(part2), NULL)</code></dd>
  206.     <dt>SQLite3</dt>
  207.     <dd>The connection string is passed straight through to <code>sqlite3_open</code></dd>
  208.     </dl>
  209.  
  210. </div>
  211. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  212. <div class="directive-section"><h2><a name="DBDPersist" id="DBDPersist">DBDPersist</a> <a name="dbdpersist" id="dbdpersist">Directive</a></h2>
  213. <table class="directive">
  214. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Whether to use persistent connections</td></tr>
  215. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDPersist On|Off</code></td></tr>
  216. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  217. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  218. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
  219. </table>
  220.     <p>If set to Off, persistent and pooled connections are disabled.
  221.     A new database connection is opened when requested by a client,
  222.     and closed immediately on release.  This option is for debugging
  223.     and low-usage servers.</p>
  224.  
  225.     <p>The default is to enable a pool of persistent connections
  226.     (or a single LAMP-style persistent connection in the case of a
  227.     non-threaded server), and should almost always be used in operation.</p>
  228.  
  229.     <p>Prior to version 2.2.2, this directive accepted only the values
  230.     <code>0</code> and <code>1</code> instead of <code>Off</code> and
  231.     <code>On</code>, respectively.</p>
  232.  
  233. </div>
  234. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  235. <div class="directive-section"><h2><a name="DBDPrepareSQL" id="DBDPrepareSQL">DBDPrepareSQL</a> <a name="dbdpreparesql" id="dbdpreparesql">Directive</a></h2>
  236. <table class="directive">
  237. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define an SQL prepared statement</td></tr>
  238. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDPrepareSQL <var>"SQL statement"</var> <var>label</var></code></td></tr>
  239. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  240. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  241. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
  242. </table>
  243.     <p>For modules such as authentication that use repeatedly use a
  244.     single SQL statement, optimum performance is achieved by preparing
  245.     the statement at startup rather than every time it is used.
  246.     This directive prepares an SQL statement and assigns it a label.</p>
  247.  
  248. </div>
  249. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  250. <div class="directive-section"><h2><a name="DBDriver" id="DBDriver">DBDriver</a> <a name="dbdriver" id="dbdriver">Directive</a></h2>
  251. <table class="directive">
  252. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify an SQL driver</td></tr>
  253. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDriver <var>name</var></code></td></tr>
  254. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
  255. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  256. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
  257. </table>
  258.     <p>Selects an apr_dbd driver by name.  The driver must be installed
  259.     on your system (on most systems, it will be a shared object or dll).
  260.     For example, <code>DBDriver mysql</code> will select the MySQL
  261.     driver in apr_dbd_mysql.so.</p>
  262.  
  263. </div>
  264. </div>
  265. <div class="bottomlang">
  266. <p><span>Available Languages: </span><a href="../en/mod/mod_dbd.html" title="English"> en </a></p>
  267. </div><div id="footer">
  268. <p class="apache">Copyright 2007 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
  269. <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
  270. </body></html>