]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_dbd.html.en
move es and fr targets to *.utf8 extension. Update transformation
[apache] / docs / manual / mod / mod_dbd.html.en
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 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
5 <!--
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7               This file is generated from xml source: DO NOT EDIT
8         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9       -->
10 <title>mod_dbd - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
15 </script>
16
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
18 <body>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.png" /></div>
23 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
24 <div id="path">
25 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Modules</a></div>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache Module mod_dbd</h1>
28 <div class="toplang">
29 <p><span>Available Languages: </span><a href="../en/mod/mod_dbd.html" title="English">&nbsp;en&nbsp;</a> |
30 <a href="../fr/mod/mod_dbd.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a></p>
31 </div>
32 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Manages SQL database connections</td></tr>
33 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
34 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>dbd_module</td></tr>
35 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_dbd.c</td></tr></table>
36 <h3>Summary</h3>
37
38     <p><code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code> manages SQL database connections using
39     <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a>.  It provides database connections on request
40     to modules requiring SQL database functions, and takes care of
41     managing databases with optimal efficiency and scalability
42     for both threaded and non-threaded MPMs.  For details, see the
43     <a href="http://apr.apache.org/">APR</a> website and this overview of the
44     <a href="http://people.apache.org/~niq/dbd.html">Apache DBD Framework</a>
45     by its original developer.
46 </p>
47 </div>
48 <div id="quickview"><h3>Topics</h3>
49 <ul id="topics">
50 <li><img alt="" src="../images/down.gif" /> <a href="#pooling">Connection Pooling</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#connecting">Connecting</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#API">Apache DBD API</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#prepared">SQL Prepared Statements</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#security">SECURITY WARNING</a></li>
55 </ul><h3 class="directives">Directives</h3>
56 <ul id="toc">
57 <li><img alt="" src="../images/down.gif" /> <a href="#dbdexptime">DBDExptime</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#dbdinitsql">DBDInitSQL</a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#dbdkeep">DBDKeep</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#dbdmax">DBDMax</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#dbdmin">DBDMin</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#dbdparams">DBDParams</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#dbdpersist">DBDPersist</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#dbdpreparesql">DBDPrepareSQL</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#dbdriver">DBDriver</a></li>
66 </ul>
67 <h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&amp;list_id=144532&amp;product=Apache%20httpd-2&amp;query_format=specific&amp;order=changeddate%20DESC%2Cpriority%2Cbug_severity&amp;component=mod_dbd">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&amp;component=mod_dbd">Report a bug</a></li></ul><h3>See also</h3>
68 <ul class="seealso">
69 <li><a href="../misc/password_encryptions.html">Password Formats</a></li>
70 <li><a href="#comments_section">Comments</a></li></ul></div>
71 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
72 <div class="section">
73 <h2><a name="pooling" id="pooling">Connection Pooling</a><a title="Permanent link" href="#pooling" class="permalink">&para;</a></h2>
74     <p>This module manages database connections, in a manner
75     optimised for the platform.  On non-threaded platforms,
76     it provides a persistent connection in the manner of
77     classic LAMP (Linux, Apache, Mysql, Perl/PHP/Python).
78     On threaded platform, it provides an altogether more
79     scalable and efficient <em>connection pool</em>, as
80     described in <a href="http://www.apachetutor.org/dev/reslist">this
81     article at ApacheTutor</a>.  Note that <code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code>
82     supersedes the modules presented in that article.</p>
83 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
84 <div class="section">
85 <h2><a name="connecting" id="connecting">Connecting</a><a title="Permanent link" href="#connecting" class="permalink">&para;</a></h2>
86
87     <p>To connect to your database, you'll need to specify
88     a driver, and connection parameters. These vary from
89     one database engine to another. For example, to connect
90     to mysql, do the following:</p>
91
92 <pre class="prettyprint lang-config">DBDriver mysql
93 DBDParams host=localhost,dbname=pony,user=shetland,pass=appaloosa</pre>
94
95
96     <p>You can then use this connection in a variety of other
97     modules, including <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>,
98     <code class="module"><a href="../mod/mod_authn_dbd.html">mod_authn_dbd</a></code>, and <code class="module"><a href="../mod/mod_lua.html">mod_lua</a></code>.
99     Further usage examples appear in each of those modules'
100     documentation.</p>
101
102     <p>See <code class="directive">DBDParams</code> for connection string
103     information for each of the supported database drivers.</p>
104
105 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
106 <div class="section">
107 <h2><a name="API" id="API">Apache DBD API</a><a title="Permanent link" href="#API" class="permalink">&para;</a></h2>
108     <p><code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code> exports five functions for other modules
109     to use. The API is as follows:</p>
110
111 <pre class="prettyprint lang-c">typedef struct {
112     apr_dbd_t *handle;
113     apr_dbd_driver_t *driver;
114     apr_hash_t *prepared;
115 } ap_dbd_t;
116
117 /* Export functions to access the database */
118
119 /* acquire a connection that MUST be explicitly closed.
120  * Returns NULL on error
121  */
122 AP_DECLARE(ap_dbd_t*) ap_dbd_open(apr_pool_t*, server_rec*);
123
124 /* release a connection acquired with ap_dbd_open */
125 AP_DECLARE(void) ap_dbd_close(server_rec*, ap_dbd_t*);
126
127 /* acquire a connection that will have the lifetime of a request
128  * and MUST NOT be explicitly closed.  Return NULL on error.
129  * This is the preferred function for most applications.
130  */
131 AP_DECLARE(ap_dbd_t*) ap_dbd_acquire(request_rec*);
132
133 /* acquire a connection that will have the lifetime of a connection
134  * and MUST NOT be explicitly closed.  Return NULL on error.
135  */
136 AP_DECLARE(ap_dbd_t*) ap_dbd_cacquire(conn_rec*);
137
138 /* Prepare a statement for use by a client module */
139 AP_DECLARE(void) ap_dbd_prepare(server_rec*, const char*, const char*);
140
141 /* Also export them as optional functions for modules that prefer it */
142 APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_open, (apr_pool_t*, server_rec*));
143 APR_DECLARE_OPTIONAL_FN(void, ap_dbd_close, (server_rec*, ap_dbd_t*));
144 APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_acquire, (request_rec*));
145 APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_cacquire, (conn_rec*));
146 APR_DECLARE_OPTIONAL_FN(void, ap_dbd_prepare, (server_rec*, const char*, const char*));</pre>
147
148 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
149 <div class="section">
150 <h2><a name="prepared" id="prepared">SQL Prepared Statements</a><a title="Permanent link" href="#prepared" class="permalink">&para;</a></h2>
151     <p><code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code> supports SQL prepared statements on behalf
152     of modules that may wish to use them.  Each prepared statement
153     must be assigned a name (label), and they are stored in a hash:
154     the <code>prepared</code> field of an <code>ap_dbd_t</code>.
155     Hash entries are of type <code>apr_dbd_prepared_t</code>
156     and can be used in any of the apr_dbd prepared statement
157     SQL query or select commands.</p>
158
159     <p>It is up to dbd user modules to use the prepared statements
160     and document what statements can be specified in httpd.conf,
161     or to provide their own directives and use <code>ap_dbd_prepare</code>.</p>
162
163         <div class="warning"><h3>Caveat</h3>
164         When using prepared statements with a MySQL database, it is preferred to set
165         <code>reconnect</code> to 0 in the connection string as to avoid errors that
166         arise from the MySQL client reconnecting without properly resetting the
167         prepared statements. If set to 1, any broken connections will be attempted
168         fixed, but as mod_dbd is not informed, the prepared statements will be invalidated.
169         </div>
170 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
171 <div class="section">
172 <h2><a name="security" id="security">SECURITY WARNING</a><a title="Permanent link" href="#security" class="permalink">&para;</a></h2>
173
174     <p>Any web/database application needs to secure itself against SQL
175     injection attacks.  In most cases, Apache DBD is safe, because
176     applications use prepared statements, and untrusted inputs are
177     only ever used as data.  Of course, if you use it via third-party
178     modules, you should ascertain what precautions they may require.</p>
179     <p>However, the <var>FreeTDS</var> driver is inherently
180     <strong>unsafe</strong>.  The underlying library doesn't support
181     prepared statements, so the driver emulates them, and the
182     untrusted input is merged into the SQL statement.</p>
183     <p>It can be made safe by <em>untainting</em> all inputs:
184     a process inspired by Perl's taint checking.  Each input
185     is matched against a regexp, and only the match is used,
186     according to the Perl idiom:</p>
187     <div class="example"><pre><code>  $untrusted =~ /([a-z]+)/;
188   $trusted = $1;</code></pre></div>
189     <p>To use this, the untainting regexps must be included in the
190     prepared statements configured.  The regexp follows immediately
191     after the % in the prepared statement, and is enclosed in
192     curly brackets {}.  For example, if your application expects
193     alphanumeric input, you can use:</p>
194     <div class="example"><p><code>
195        <code>"SELECT foo FROM bar WHERE input = %s"</code>
196     </code></p></div>
197     <p>with other drivers, and suffer nothing worse than a failed query.
198     But with FreeTDS you'd need:</p>
199     <div class="example"><p><code>
200        <code>"SELECT foo FROM bar WHERE input = %{([A-Za-z0-9]+)}s"</code>
201     </code></p></div>
202     <p>Now anything that doesn't match the regexp's $1 match is
203     discarded, so the statement is safe.</p>
204     <p>An alternative to this may be the third-party ODBC driver,
205     which offers the security of genuine prepared statements.</p>
206 </div>
207 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
208 <div class="directive-section"><h2><a name="DBDExptime" id="DBDExptime">DBDExptime</a> <a name="dbdexptime" id="dbdexptime">Directive</a><a title="Permanent link" href="#dbdexptime" class="permalink">&para;</a></h2>
209 <table class="directive">
210 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Keepalive time for idle connections</td></tr>
211 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDExptime <var>time-in-seconds</var></code></td></tr>
212 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DBDExptime 300</code></td></tr>
213 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
214 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
215 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
216 </table>
217     <p>Set the time to keep idle connections alive when the number
218     of connections specified in DBDKeep has been exceeded (threaded
219     platforms only).</p>
220
221 </div>
222 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
223 <div class="directive-section"><h2><a name="DBDInitSQL" id="DBDInitSQL">DBDInitSQL</a> <a name="dbdinitsql" id="dbdinitsql">Directive</a><a title="Permanent link" href="#dbdinitsql" class="permalink">&para;</a></h2>
224 <table class="directive">
225 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Execute an SQL statement after connecting to a database</td></tr>
226 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDInitSQL <var>"SQL statement"</var></code></td></tr>
227 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
228 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
229 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
230 </table>
231     <p>Modules, that wish it, can have one or more SQL statements
232     executed when a connection to a database is created. Example
233     usage could be initializing certain values or adding a log
234     entry when a new connection is made to the database.</p>
235
236 </div>
237 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
238 <div class="directive-section"><h2><a name="DBDKeep" id="DBDKeep">DBDKeep</a> <a name="dbdkeep" id="dbdkeep">Directive</a><a title="Permanent link" href="#dbdkeep" class="permalink">&para;</a></h2>
239 <table class="directive">
240 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum sustained number of connections</td></tr>
241 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDKeep <var>number</var></code></td></tr>
242 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DBDKeep 2</code></td></tr>
243 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
244 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
245 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
246 </table>
247     <p>Set the maximum number of connections per process to be
248     sustained, other than for handling peak demand (threaded
249     platforms only).</p>
250
251 </div>
252 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
253 <div class="directive-section"><h2><a name="DBDMax" id="DBDMax">DBDMax</a> <a name="dbdmax" id="dbdmax">Directive</a><a title="Permanent link" href="#dbdmax" class="permalink">&para;</a></h2>
254 <table class="directive">
255 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of connections</td></tr>
256 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDMax <var>number</var></code></td></tr>
257 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DBDMax 10</code></td></tr>
258 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
259 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
260 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
261 </table>
262     <p>Set the hard maximum number of connections per process
263     (threaded platforms only).</p>
264
265 </div>
266 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
267 <div class="directive-section"><h2><a name="DBDMin" id="DBDMin">DBDMin</a> <a name="dbdmin" id="dbdmin">Directive</a><a title="Permanent link" href="#dbdmin" class="permalink">&para;</a></h2>
268 <table class="directive">
269 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of connections</td></tr>
270 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDMin <var>number</var></code></td></tr>
271 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DBDMin 1</code></td></tr>
272 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
273 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
274 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
275 </table>
276     <p>Set the minimum number of connections per process (threaded
277     platforms only).</p>
278
279 </div>
280 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
281 <div class="directive-section"><h2><a name="DBDParams" id="DBDParams">DBDParams</a> <a name="dbdparams" id="dbdparams">Directive</a><a title="Permanent link" href="#dbdparams" class="permalink">&para;</a></h2>
282 <table class="directive">
283 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Parameters for database connection</td></tr>
284 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDParams
285 <var>param1</var>=<var>value1</var>[,<var>param2</var>=<var>value2</var>]</code></td></tr>
286 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
287 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
288 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
289 </table>
290     <p>As required by the underlying driver.  Typically this will be
291     used to pass whatever cannot be defaulted amongst username,
292     password, database name, hostname and port number for connection.</p>
293     <p>Connection string parameters for current drivers include:</p>
294     <dl>
295     <dt>FreeTDS (for MSSQL and SyBase)</dt>
296     <dd>username, password, appname, dbname, host, charset, lang, server</dd>
297     <dt>MySQL</dt>
298     <dd>host, port, user, pass, dbname, sock, flags, fldsz, group, reconnect</dd>
299     <dt>Oracle</dt>
300     <dd>user, pass, dbname, server</dd>
301     <dt>PostgreSQL</dt>
302     <dd>The connection string is passed straight through to <code>PQconnectdb</code></dd>
303     <dt>SQLite2</dt>
304     <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>
305     <dt>SQLite3</dt>
306     <dd>The connection string is passed straight through to <code>sqlite3_open</code></dd>
307     <dt>ODBC</dt>
308     <dd>datasource, user, password, connect, ctimeout, stimeout, access, txmode, bufsize</dd>
309     </dl>
310
311 </div>
312 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
313 <div class="directive-section"><h2><a name="DBDPersist" id="DBDPersist">DBDPersist</a> <a name="dbdpersist" id="dbdpersist">Directive</a><a title="Permanent link" href="#dbdpersist" class="permalink">&para;</a></h2>
314 <table class="directive">
315 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Whether to use persistent connections</td></tr>
316 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDPersist On|Off</code></td></tr>
317 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
318 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
319 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
320 </table>
321     <p>If set to Off, persistent and pooled connections are disabled.
322     A new database connection is opened when requested by a client,
323     and closed immediately on release.  This option is for debugging
324     and low-usage servers.</p>
325
326     <p>The default is to enable a pool of persistent connections
327     (or a single LAMP-style persistent connection in the case of a
328     non-threaded server), and should almost always be used in operation.</p>
329
330     <p>Prior to version 2.2.2, this directive accepted only the values
331     <code>0</code> and <code>1</code> instead of <code>Off</code> and
332     <code>On</code>, respectively.</p>
333
334 </div>
335 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
336 <div class="directive-section"><h2><a name="DBDPrepareSQL" id="DBDPrepareSQL">DBDPrepareSQL</a> <a name="dbdpreparesql" id="dbdpreparesql">Directive</a><a title="Permanent link" href="#dbdpreparesql" class="permalink">&para;</a></h2>
337 <table class="directive">
338 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define an SQL prepared statement</td></tr>
339 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDPrepareSQL <var>"SQL statement"</var> <var>label</var></code></td></tr>
340 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
341 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
342 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
343 </table>
344     <p>For modules such as authentication that repeatedly use a
345     single SQL statement, optimum performance is achieved by preparing
346     the statement at startup rather than every time it is used.
347     This directive prepares an SQL statement and assigns it a label.</p>
348
349 </div>
350 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
351 <div class="directive-section"><h2><a name="DBDriver" id="DBDriver">DBDriver</a> <a name="dbdriver" id="dbdriver">Directive</a><a title="Permanent link" href="#dbdriver" class="permalink">&para;</a></h2>
352 <table class="directive">
353 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify an SQL driver</td></tr>
354 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DBDriver <var>name</var></code></td></tr>
355 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
356 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
357 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dbd</td></tr>
358 </table>
359     <p>Selects an apr_dbd driver by name.  The driver must be installed
360     on your system (on most systems, it will be a shared object or dll).
361     For example, <code>DBDriver mysql</code> will select the MySQL
362     driver in apr_dbd_mysql.so.</p>
363
364 </div>
365 </div>
366 <div class="bottomlang">
367 <p><span>Available Languages: </span><a href="../en/mod/mod_dbd.html" title="English">&nbsp;en&nbsp;</a> |
368 <a href="../fr/mod/mod_dbd.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a></p>
369 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
370 <script type="text/javascript"><!--//--><![CDATA[//><!--
371 var comments_shortname = 'httpd';
372 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_dbd.html';
373 (function(w, d) {
374     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
375         d.write('<div id="comments_thread"><\/div>');
376         var s = d.createElement('script');
377         s.type = 'text/javascript';
378         s.async = true;
379         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
380         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
381     }
382     else {
383         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
384     }
385 })(window, document);
386 //--><!]]></script></div><div id="footer">
387 <p class="apache">Copyright 2018 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>
388 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
389 if (typeof(prettyPrint) !== 'undefined') {
390     prettyPrint();
391 }
392 //--><!]]></script>
393 </body></html>