Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "DBI::FAQ 3" | |
132 | .TH DBI::FAQ 3 "2002-10-01" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | DBI::FAQ \-\- The Frequently Asked Questions for the Perl5 Database Interface | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 1 | |
138 | \& perldoc DBI::FAQ | |
139 | .Ve | |
140 | .SH "VERSION" | |
141 | .IX Header "VERSION" | |
142 | This document is currently at version \fI0.38\fR, as of \fIFebruary 8th, 2000\fR. | |
143 | .SH "DESCRIPTION" | |
144 | .IX Header "DESCRIPTION" | |
145 | This document serves to answer the most frequently asked questions on both | |
146 | the \s-1DBI\s0 Mailing Lists and personally to members of the \s-1DBI\s0 development team. | |
147 | .SH "Basic Information & Information Sources" | |
148 | .IX Header "Basic Information & Information Sources" | |
149 | .Sh "1.1 What is \s-1DBI\s0, DBperl, Oraperl and *perl?" | |
150 | .IX Subsection "1.1 What is DBI, DBperl, Oraperl and *perl?" | |
151 | To quote Tim Bunce, the architect and author of \s-1DBI:\s0 | |
152 | .PP | |
153 | .Vb 4 | |
154 | \& ``DBI is a database access Application Programming Interface (API) | |
155 | \& for the Perl Language. The DBI API Specification defines a set | |
156 | \& of functions, variables and conventions that provide a consistent | |
157 | \& database interface independant of the actual database being used.'' | |
158 | .Ve | |
159 | .PP | |
160 | In simple language, the \s-1DBI\s0 interface allows users to access multiple database | |
161 | types transparently. So, if you connecting to an Oracle, Informix, mSQL, Sybase | |
162 | or whatever database, you don't need to know the underlying mechanics of the | |
163 | 3GL layer. The \s-1API\s0 defined by \s-1DBI\s0 will work on \fIall\fR these database types. | |
164 | .PP | |
165 | A similar benefit is gained by the ability to connect to two \fIdifferent\fR | |
166 | databases of different vendor within the one perl script, \fIie\fR, I want | |
167 | to read data from an Oracle database and insert it back into an Informix | |
168 | database all within one program. The \s-1DBI\s0 layer allows you to do this simply | |
169 | and powerfully. | |
170 | .PP | |
171 | \&\fIDBperl\fR is the old name for the interface specification. It's usually | |
172 | now used to denote perl\fI4\fR modules on database interfacing, such as, | |
173 | \&\fIoraperl\fR, \fIisqlperl\fR, \fIingperl\fR and so on. These interfaces | |
174 | didn't have a standard \s-1API\s0 and are generally \fInot\fR supported. | |
175 | .PP | |
176 | Here's a list of DBperl modules, their corresponding \s-1DBI\s0 counterparts and | |
177 | support information. \fIPlease note\fR, the author's listed here generally | |
178 | \&\fIdo not\fR maintain the \s-1DBI\s0 module for the same database. These email | |
179 | addresses are unverified and should only be used for queries concerning the | |
180 | perl4 modules listed below. \s-1DBI\s0 driver queries should be directed to the | |
181 | \&\fIdbi-users\fR mailing list. | |
182 | .PP | |
183 | .Vb 23 | |
184 | \& Module Name Database Required Author DBI | |
185 | \& ----------- ----------------- ------ --- | |
186 | \& Sybperl Sybase Michael Peppler DBD::Sybase | |
187 | \& <mpeppler@itf.ch> | |
188 | \& Oraperl Oracle 6 & 7 Kevin Stock DBD::Oracle | |
189 | \& <dbi-users@perl.org> | |
190 | \& Ingperl Ingres Tim Bunce & DBD::Ingres | |
191 | \& Ted Lemon | |
192 | \& <dbi-users@perl.org> | |
193 | \& Interperl Interbase Buzz Moschetti DBD::Interbase | |
194 | \& <buzz@bear.com> | |
195 | \& Uniperl Unify 5.0 Rick Wargo None | |
196 | \& <rickers@coe.drexel.edu> | |
197 | \& Pgperl Postgres Igor Metz DBD::Pg | |
198 | \& <metz@iam.unibe.ch> | |
199 | \& Btreeperl NDBM John Conover SDBM? | |
200 | \& <john@johncon.com> | |
201 | \& Ctreeperl C-Tree John Conover None | |
202 | \& <john@johncon.com> | |
203 | \& Cisamperl Informix C-ISAM Mathias Koerber None | |
204 | \& <mathias@unicorn.swi.com.sg> | |
205 | \& Duaperl X.500 Directory Eric Douglas None | |
206 | \& User Agent | |
207 | .Ve | |
208 | .PP | |
209 | However, some \s-1DBI\s0 modules have DBperl emulation layers, so, \fIDBD::Oracle\fR | |
210 | comes with an Oraperl emulation layer, which allows you to run legacy oraperl | |
211 | scripts without modification. The emulation layer translates the oraperl \s-1API\s0 | |
212 | calls into \s-1DBI\s0 calls and executes them through the \s-1DBI\s0 switch. | |
213 | .PP | |
214 | Here's a table of emulation layer information: | |
215 | .PP | |
216 | .Vb 8 | |
217 | \& Module Emulation Layer Status | |
218 | \& ------ --------------- ------ | |
219 | \& DBD::Oracle Oraperl Complete | |
220 | \& DBD::Informix Isqlperl Under development | |
221 | \& DBD::Ingres Ingperl Complete? | |
222 | \& DBD::Sybase Sybperl Working? ( Needs verification ) | |
223 | \& DBD::mSQL Msqlperl Experimentally released with | |
224 | \& DBD::mSQL-0.61 | |
225 | .Ve | |
226 | .PP | |
227 | The \fIMsqlperl\fR emulation is a special case. \fIMsqlperl\fR is a perl5 driver | |
228 | for \fImSQL\fR databases, but does not conform to the \s-1DBI\s0 Specification. It's | |
229 | use is being deprecated in favour of \fIDBD::mSQL\fR. \fIMsqlperl\fR may be downloaded | |
230 | from \s-1CPAN\s0 \fIvia\fR: | |
231 | .PP | |
232 | .Vb 1 | |
233 | \& http://www.perl.com/cgi-bin/cpan_mod?module=Msqlperl | |
234 | .Ve | |
235 | .Sh "1.2. Where can I get it from?" | |
236 | .IX Subsection "1.2. Where can I get it from?" | |
237 | The Comprehensive Perl Archive Network | |
238 | resources should be used for retrieving up-to-date versions of the \s-1DBI\s0 | |
239 | and drivers. \s-1CPAN\s0 may be accessed \fIvia\fR Tom Christiansen's splendid | |
240 | \&\fI\s-1CPAN\s0 multiplexer\fR program located at: | |
241 | .PP | |
242 | .Vb 1 | |
243 | \& http://www.perl.com/CPAN/ | |
244 | .Ve | |
245 | .PP | |
246 | For more specific version information and exact URLs of drivers, please see | |
247 | the \s-1DBI\s0 drivers list and the \s-1DBI\s0 module pages which can be found on: | |
248 | .PP | |
249 | .Vb 2 | |
250 | \& http://dbi.perl.org/ | |
251 | \& http://www.symbolstone.org/technology/perl/DBI | |
252 | .Ve | |
253 | .PP | |
254 | This list is automatically generated on a nightly basis from \s-1CPAN\s0 and should | |
255 | be up\-to\-date. | |
256 | .Sh "1.3. Where can I get more information?" | |
257 | .IX Subsection "1.3. Where can I get more information?" | |
258 | There are a few information sources on \s-1DBI\s0. | |
259 | .ie n .IP "\fI""Programming the Perl \s-1DBI\s0""\fR" 4 | |
260 | .el .IP "\fI``Programming the Perl \s-1DBI\s0''\fR" 4 | |
261 | .IX Item "Programming the Perl DBI" | |
262 | \&\*(L"Programming the Perl \s-1DBI\s0\*(R" is the \fIofficial\fR book on the \s-1DBI\s0 written by | |
263 | Alligator Descartes and Tim Bunce and published by O'Reilly & Associates. | |
264 | The book was released on February 9th, 2000. | |
265 | .Sp | |
266 | The table of contents is: | |
267 | .Sp | |
268 | .Vb 56 | |
269 | \& Preface | |
270 | \& 1. Introduction | |
271 | \& From Mainframes to Workstations | |
272 | \& Perl | |
273 | \& DBI in the Real World | |
274 | \& A Historical Interlude and Standing Stones | |
275 | \& 2. Basic Non-DBI Databases | |
276 | \& Storage Managers and Layers | |
277 | \& Query Languages and Data Functions | |
278 | \& Standing Stones and the Sample Database | |
279 | \& Flat-File Databases | |
280 | \& Putting Complex Data into Flat Files | |
281 | \& Concurrent Database Access and Locking | |
282 | \& DBM Files and the Berkeley Database Manager | |
283 | \& The MLDBM Module | |
284 | \& Summary | |
285 | \& 3. SQL and Relational Databases | |
286 | \& The Relational Database Methodology | |
287 | \& Datatypes and NULL Values | |
288 | \& Querying Data | |
289 | \& Modifying Data Within Tables | |
290 | \& Creating and Destroying Tables | |
291 | \& 4. Programming with the DBI | |
292 | \& DBI Architecture | |
293 | \& Handles | |
294 | \& Data Source Names | |
295 | \& Connection and Disconnection | |
296 | \& Error Handling | |
297 | \& Utility Methods and Functions | |
298 | \& 5. Interacting with the Database | |
299 | \& Issuing Simple Queries | |
300 | \& Executing Non-SELECT Statements | |
301 | \& Binding Parameters to Statements | |
302 | \& Binding Output Columns | |
303 | \& do() Versus prepare() | |
304 | \& Atomic and Batch Fetching | |
305 | \& 6. Advanced DBI | |
306 | \& Handle Attributes and Metadata | |
307 | \& Handling LONG/LOB Data | |
308 | \& Transactions, Locking, and Isolation | |
309 | \& 7. ODBC and the DBI | |
310 | \& ODBC -- Embraced and Extended | |
311 | \& DBI -- Thrashed and Mutated | |
312 | \& The Nuts and Bolts of ODBC | |
313 | \& ODBC from Perl | |
314 | \& The Marriage of DBI and ODBC | |
315 | \& Questions and Choices | |
316 | \& Moving Between Win32::ODBC and the DBI | |
317 | \& And What About ADO? | |
318 | \& 8. DBI Shell and Database Proxying | |
319 | \& dbish -- The DBI Shell | |
320 | \& Database Proxying | |
321 | \& A. DBI Specification | |
322 | \& B. Driver and Database Characteristics | |
323 | \& C. ASLaN Sacred Site Charter | |
324 | \& Index | |
325 | .Ve | |
326 | .Sp | |
327 | The book should be available from all good bookshops and can be ordered online | |
328 | either <I>via</I> O'Reilly & Associates | |
329 | .Sp | |
330 | .Vb 1 | |
331 | \& http://www.oreilly.com/catalog/perldbi | |
332 | .Ve | |
333 | .Sp | |
334 | or Amazon | |
335 | .Sp | |
336 | .Vb 1 | |
337 | \& http://www.amazon.com/exec/obidos/ASIN/1565926994/dbi | |
338 | .Ve | |
339 | .IP "\fI\s-1POD\s0 documentation\fR" 4 | |
340 | .IX Item "POD documentation" | |
341 | \&\fI\s-1POD\s0\fRs are chunks of documentation usually embedded within perl programs | |
342 | that document the code ``\fIin place\fR'', providing a useful resource for | |
343 | programmers and users of modules. \s-1POD\s0 for \s-1DBI\s0 and drivers is beginning to | |
344 | become more commonplace, and documentation for these modules can be read | |
345 | with the \f(CW\*(C`perldoc\*(C'\fR program included with Perl. | |
346 | .RS 4 | |
347 | .IP "The \s-1DBI\s0 Specification" 4 | |
348 | .IX Item "The DBI Specification" | |
349 | The \s-1POD\s0 for the \s-1DBI\s0 Specification can be read with the: | |
350 | .Sp | |
351 | .Vb 1 | |
352 | \& perldoc DBI | |
353 | .Ve | |
354 | .Sp | |
355 | command. The Specification also forms Appendix A of \*(L"Programming the Perl | |
356 | \&\s-1DBI\s0\*(R". | |
357 | .IP "Oraperl" 4 | |
358 | .IX Item "Oraperl" | |
359 | Users of the Oraperl emulation layer bundled with \fIDBD::Oracle\fR, may read | |
360 | up on how to program with the Oraperl interface by typing: | |
361 | .Sp | |
362 | .Vb 1 | |
363 | \& perldoc Oraperl | |
364 | .Ve | |
365 | .Sp | |
366 | This will produce an updated copy of the original oraperl man page written by | |
367 | Kevin Stock for perl4. The oraperl \s-1API\s0 is fully listed and described there. | |
368 | .IP "Drivers" 4 | |
369 | .IX Item "Drivers" | |
370 | Users of the \s-1DBD\s0 modules may read about some of the private functions | |
371 | and quirks of that driver by typing: | |
372 | .Sp | |
373 | .Vb 1 | |
374 | \& perldoc <driver> | |
375 | .Ve | |
376 | .Sp | |
377 | For example, the \fIDBD::mSQL\fR driver is bundled with driver-specific | |
378 | documentation that can be accessed by typing | |
379 | .Sp | |
380 | .Vb 1 | |
381 | \& perldoc DBD::mSQL | |
382 | .Ve | |
383 | .IP "Frequently Asked Questions" 4 | |
384 | .IX Item "Frequently Asked Questions" | |
385 | This document, the \fIFrequently Asked Questions\fR is also available as \s-1POD\s0 | |
386 | documentation! You can read this on your own system by typing: | |
387 | .Sp | |
388 | .Vb 1 | |
389 | \& perldoc DBI::FAQ | |
390 | .Ve | |
391 | .Sp | |
392 | This may be more convenient to persons not permanently, or conveniently, | |
393 | connected to the Internet. The \fI\s-1DBI::FAQ\s0\fR module should be downloaded and | |
394 | installed for the more up-to-date version. | |
395 | .Sp | |
396 | The version of \fI\s-1DBI::FAQ\s0\fR shipped with the \f(CW\*(C`DBI\*(C'\fR module may be slightly out | |
397 | of date. | |
398 | .IP "\s-1POD\s0 in general" 4 | |
399 | .IX Item "POD in general" | |
400 | Information on writing \s-1POD\s0, and on the philosophy of \s-1POD\s0 in general, can be | |
401 | read by typing: | |
402 | .Sp | |
403 | .Vb 1 | |
404 | \& perldoc perlpod | |
405 | .Ve | |
406 | .Sp | |
407 | Users with the Tk module installed may be interested to learn there is a | |
408 | Tk-based \s-1POD\s0 reader available called \f(CW\*(C`tkpod\*(C'\fR, which formats \s-1POD\s0 in a convenient | |
409 | and readable way. This is available \fIvia\fR \s-1CPAN\s0 as the module called | |
410 | \&\fITk::POD\fR and is highly recommended. | |
411 | .RE | |
412 | .RS 4 | |
413 | .RE | |
414 | .IP "\fIDriver and Database Characteristics\fR" 4 | |
415 | .IX Item "Driver and Database Characteristics" | |
416 | The driver summaries that were produced for Appendix B of \*(L"Programming the | |
417 | Perl \s-1DBI\s0\*(R" are available online at: | |
418 | .Sp | |
419 | .Vb 2 | |
420 | \& http://dbi.perl.org/ | |
421 | \& http://www.symbolstone.org/technology/perl/DBI | |
422 | .Ve | |
423 | .Sp | |
424 | in the driver information table. These summaries contain standardised | |
425 | information on each driver and database which should aid you in selecting | |
426 | a database to use. It will also inform you quickly of any issues within | |
427 | drivers or whether a driver is not fully compliant with the \s-1DBI\s0 Specification. | |
428 | .IP "\fIRambles, Tidbits and Observations\fR" 4 | |
429 | .IX Item "Rambles, Tidbits and Observations" | |
430 | .Vb 2 | |
431 | \& http://dbi.perl.org/tidbits | |
432 | \& http://www.symbolstone.org/technology/perl/DBI/tidbits | |
433 | .Ve | |
434 | .Sp | |
435 | There are a series of occasional rambles from various people on the | |
436 | \&\s-1DBI\s0 mailing lists who, in an attempt to clear up a simple point, end up | |
437 | drafting fairly comprehensive documents. These are quite often varying in | |
438 | quality, but do provide some insights into the workings of the interfaces. | |
439 | .IP "\fIArticles\fR" 4 | |
440 | .IX Item "Articles" | |
441 | A list of articles discussing the \s-1DBI\s0 can be found on the \s-1DBI\s0 \s-1WWW\s0 page at: | |
442 | .Sp | |
443 | .Vb 2 | |
444 | \& http://dbi.perl.org/ | |
445 | \& http://www.symbolstone.org/technology/perl/DBI | |
446 | .Ve | |
447 | .Sp | |
448 | These articles are of varying quality and age, from the original Perl Journal | |
449 | article written by Alligator and Tim, to more recent debacles published online | |
450 | from about.com. | |
451 | .IP "\fI\s-1README\s0 files\fR" 4 | |
452 | .IX Item "README files" | |
453 | The \fI\s-1README\s0\fR files included with each driver occasionally contains | |
454 | some useful information ( no, really! ) that may be pertinent to the user. | |
455 | Please read them. It makes our worthless existences more bearable. These | |
456 | can all be read from the main \s-1DBI\s0 \s-1WWW\s0 page at: | |
457 | .Sp | |
458 | .Vb 2 | |
459 | \& http://dbi.perl.org/ | |
460 | \& http://www.symbolstone.org/technology/perl/DBI | |
461 | .Ve | |
462 | .IP "\fIMailing Lists\fR" 4 | |
463 | .IX Item "Mailing Lists" | |
464 | There are three mailing lists for \s-1DBI:\s0 | |
465 | .Sp | |
466 | .Vb 3 | |
467 | \& dbi-announce@perl.org -- for announcements, very low traffic | |
468 | \& dbi-users@perl.org -- general user support | |
469 | \& dbi-dev@perl.org -- for driver developers (no user support) | |
470 | .Ve | |
471 | .Sp | |
472 | For information on how to subscribe, set digest mode etc, and unsubscribe, | |
473 | send an email message (the content will be ignored) to: | |
474 | .Sp | |
475 | .Vb 3 | |
476 | \& dbi-announce-help@perl.org | |
477 | \& dbi-users-help@perl.org | |
478 | \& dbi-dev-help@perl.org | |
479 | .Ve | |
480 | .IP "\fIMailing List Archives\fR" 4 | |
481 | .IX Item "Mailing List Archives" | |
482 | .RS 4 | |
483 | .PD 0 | |
484 | .IP "\fI\s-1US\s0 Mailing List Archives\fR" 4 | |
485 | .IX Item "US Mailing List Archives" | |
486 | .PD | |
487 | .Vb 1 | |
488 | \& http://outside.organic.com/mail-archives/dbi-users/ | |
489 | .Ve | |
490 | .Sp | |
491 | Searchable hypermail archives of the three mailing lists, and some of the | |
492 | much older traffic have been set up for users to browse. | |
493 | .IP "\fIEuropean Mailing List Archives\fR" 4 | |
494 | .IX Item "European Mailing List Archives" | |
495 | .Vb 1 | |
496 | \& http://www.rosat.mpe-garching.mpg.de/mailing-lists/PerlDB-Interest | |
497 | .Ve | |
498 | .Sp | |
499 | As per the \s-1US\s0 archive above. | |
500 | .RE | |
501 | .RS 4 | |
502 | .RE | |
503 | .SH "Compilation Problems" | |
504 | .IX Header "Compilation Problems" | |
505 | .ie n .Sh "2.1. Compilation problems or ""It fails the test!""" | |
506 | .el .Sh "2.1. Compilation problems or ``It fails the test!''" | |
507 | .IX Subsection "2.1. Compilation problems or It fails the test!" | |
508 | First off, consult the \s-1README\s0 for that driver in case there is useful | |
509 | information about the problem. It may be a known problem for your given | |
510 | architecture and operating system or database. You can check the \s-1README\s0 | |
511 | files for each driver in advance online at: | |
512 | .PP | |
513 | .Vb 2 | |
514 | \& http://dbi.perl.org/ | |
515 | \& http://www.symbolstone.org/technology/perl/DBI | |
516 | .Ve | |
517 | .PP | |
518 | If it's a known problem, you'll probably have to wait till it gets fixed. If | |
519 | you're \fIreally\fR needing it fixed, try the following: | |
520 | .IP "\fIAttempt to fix it yourself\fR" 4 | |
521 | .IX Item "Attempt to fix it yourself" | |
522 | This technique is generally \fInot\fR recommended to the faint\-hearted. | |
523 | If you do think you have managed to fix it, then, send a patch file | |
524 | ( context diff ) to the author with an explanation of: | |
525 | .RS 4 | |
526 | .IP "\(bu" 4 | |
527 | What the problem was, and test cases, if possible. | |
528 | .IP "\(bu" 4 | |
529 | What you needed to do to fix it. Please make sure you mention everything. | |
530 | .IP "\(bu" 4 | |
531 | Platform information, database version, perl version, module version and | |
532 | \&\s-1DBI\s0 version. | |
533 | .RE | |
534 | .RS 4 | |
535 | .RE | |
536 | .IP "\fIEmail the author\fR Do \fI\s-1NOT\s0\fR whinge!" 4 | |
537 | .IX Item "Email the author Do NOT whinge!" | |
538 | Please email the address listed in the \s-1WWW\s0 pages for whichever driver you | |
539 | are having problems with. Do \fInot\fR directly email the author at a | |
540 | known address unless it corresponds with the one listed. | |
541 | .Sp | |
542 | We tend to have real jobs to do, and we do read the mailing lists for | |
543 | problems. Besides, we may not have access to <\fIinsert your | |
544 | favourite brain-damaged platform here\fR> and couldn't be of any | |
545 | assistance anyway! Apologies for sounding harsh, but that's the way of it! | |
546 | .Sp | |
547 | However, you might catch one of these creative genii at 3am when we're | |
548 | doing this sort of stuff anyway, and get a patch within 5 minutes. The | |
549 | atmosphere in the \s-1DBI\s0 circle is that we \fIdo\fR appreciate the users' | |
550 | problems, since we work in similar environments. | |
551 | .Sp | |
552 | If you are planning to email the author, please furnish as much information | |
553 | as possible, \fIie\fR: | |
554 | .RS 4 | |
555 | .IP "\(bu" 4 | |
556 | \&\fI\s-1ALL\s0\fR the information asked for in the \s-1README\s0 file in | |
557 | the problematic module. And we mean \fI\s-1ALL\s0\fR of it. We don't | |
558 | put lines like that in documentation for the good of our health, or | |
559 | to meet obscure \s-1README\s0 file standards of length. | |
560 | .IP "\(bu" 4 | |
561 | If you have a core dump, try the \fIDevel::CoreStack\fR module for | |
562 | generating a stack trace from the core dump. Send us that too. | |
563 | \&\fIDevel::CoreStack\fR can be found on \s-1CPAN\s0 at: | |
564 | .Sp | |
565 | .Vb 1 | |
566 | \& http://www.perl.com/cgi-bin/cpan_mod?module=Devel::CoreStack | |
567 | .Ve | |
568 | .IP "\(bu" 4 | |
569 | Module versions, perl version, test cases, operating system versions | |
570 | and \fIany other pertinent information\fR. | |
571 | .RE | |
572 | .RS 4 | |
573 | .Sp | |
574 | Remember, the more information you send us, the quicker we can track | |
575 | problems down. If you send us no useful information, expect nothing back. | |
576 | .Sp | |
577 | Finally, please be aware that some authors, including Tim Bunce, specifically | |
578 | request that you do \fInot\fR mail them directly. Please respect their wishes and | |
579 | use the email addresses listed in the appropriate module \f(CW\*(C`README\*(C'\fR file. | |
580 | .RE | |
581 | .IP "\fIEmail the dbi-users Mailing List\fR" 4 | |
582 | .IX Item "Email the dbi-users Mailing List" | |
583 | It's usually a fairly intelligent idea to \fIcc\fR the mailing list | |
584 | anyway with problems. The authors all read the lists, so you lose nothing | |
585 | by mailing there. | |
586 | .SH "Platform and Driver Issues" | |
587 | .IX Header "Platform and Driver Issues" | |
588 | .Sh "3.1 What's the difference between \s-1ODBC\s0 and \s-1DBI\s0?" | |
589 | .IX Subsection "3.1 What's the difference between ODBC and DBI?" | |
590 | In terms of architecture \- not much: Both define programming | |
591 | interfaces. Both allow multiple drivers to be loaded to do the | |
592 | actual work. | |
593 | .PP | |
594 | In terms of ease of use \- much: The \s-1DBI\s0 is a 'high level' interface | |
595 | that, like Perl itself, strives to make the simple things easy while | |
596 | still making the hard things possible. The \s-1ODBC\s0 is a 'low level' | |
597 | interface. All nuts\-bolts\-knobs\-and\-dials. | |
598 | .PP | |
599 | Now there's an \s-1ODBC\s0 driver for the \s-1DBI\s0 (\s-1DBD::ODBC\s0) the \*(L"What's the | |
600 | difference\*(R" question is more usefully rephrased as: | |
601 | .PP | |
602 | Chapter 7 of \*(L"Programming the Perl \s-1DBI\s0\*(R" covers this topic in far more | |
603 | detail and should be consulted. | |
604 | .Sh "3.2 What's the difference between Win32::ODBC and \s-1DBD::ODBC\s0?" | |
605 | .IX Subsection "3.2 What's the difference between Win32::ODBC and DBD::ODBC?" | |
606 | The \s-1DBI\s0, and thus \s-1DBD::ODBC\s0, has a different philosophy from the | |
607 | Win32::ODBC module: | |
608 | .PP | |
609 | The Win32::ODBC module is a 'thin' layer over the low-level \s-1ODBC\s0 \s-1API\s0. | |
610 | The \s-1DBI\s0 defines a simpler 'higher level' interface. | |
611 | .PP | |
612 | The Win32::ODBC module gives you access to more of the \s-1ODBC\s0 \s-1API\s0. | |
613 | The \s-1DBI\s0 and \s-1DBD::ODBC\s0 give you access to only the essentials. | |
614 | (But, unlike Win32::ODBC, the \s-1DBI\s0 and \s-1DBD::ODBC\s0 do support parameter | |
615 | binding and multiple prepared statements which reduces the load on | |
616 | the database server and can dramatically increase performance.) | |
617 | .PP | |
618 | The Win32::ODBC module only works on Win32 systems. | |
619 | The \s-1DBI\s0 and \s-1DBD::ODBC\s0 are very portable and work on Win32 and Unix. | |
620 | .PP | |
621 | The \s-1DBI\s0 and \s-1DBD::ODBC\s0 modules are supplied as a standard part of the | |
622 | Perl 5.004 binary distribution for Win32 (they don't work with the | |
623 | older, non\-standard, ActiveState port). | |
624 | .PP | |
625 | Scripts written with the \s-1DBI\s0 and \s-1DBD::ODBC\s0 are faster than Win32::ODBC | |
626 | on Win32 and are trivially portable to other supported database types. | |
627 | .PP | |
628 | The \s-1DBI\s0 offers optional automatic printing or \fIdie()\fRing on errors which | |
629 | makes applications simpler and more robust. | |
630 | .PP | |
631 | The current \s-1DBD::ODBC\s0 driver version 0.16 is new and not yet fully stable. | |
632 | A new release is due soon [relative to the date of the next \s-1TPJ\s0 issue :\-] | |
633 | and will be much improved and offer more \s-1ODBC\s0 functionality. | |
634 | .PP | |
635 | To summarise: The Win32::ODBC module is your best choice if you need | |
636 | access to more of the \s-1ODBC\s0 \s-1API\s0 than the \s-1DBI\s0 gives you. Otherwise, the | |
637 | \&\s-1DBI\s0 and \s-1DBD::ODBC\s0 combination may be your best bet. | |
638 | .PP | |
639 | Chapter 7 of \*(L"Programming the Perl \s-1DBI\s0\*(R" covers this topic in far more | |
640 | detail and should be consulted. | |
641 | .Sh "3.3 Is \s-1DBI\s0 supported under Windows 95 / \s-1NT\s0 platforms?" | |
642 | .IX Subsection "3.3 Is DBI supported under Windows 95 / NT platforms?" | |
643 | Finally, yes! Jeff Urlwin has been working diligently on building | |
644 | \&\fI\s-1DBI\s0\fR and \fI\s-1DBD::ODBC\s0\fR under these platforms, and, with the | |
645 | advent of a stabler perl and a port of \fIMakeMaker\fR, the project has | |
646 | come on by great leaps and bounds. | |
647 | .PP | |
648 | The \fI\s-1DBI\s0\fR and \fIDBD::Oracle\fR Win32 ports are now a standard part of \s-1DBI\s0, | |
649 | so, downloading \fI\s-1DBI\s0\fR of version higher than \fI0.81\fR should work fine as | |
650 | should using the most recent \fIDBD::Oracle\fR version. | |
651 | .Sh "3.4 Can I access Microsoft Access or SQL-Server databases with \s-1DBI\s0?" | |
652 | .IX Subsection "3.4 Can I access Microsoft Access or SQL-Server databases with DBI?" | |
653 | Yes, use the \fI\s-1DBD::ODBC\s0\fR driver. | |
654 | .Sh "3.5 Is the a \s-1DBD\s0 for <\fIinsert favourite database here\fP>?" | |
655 | .IX Subsection "3.5 Is the a DBD for <insert favourite database here>?" | |
656 | Is is listed on the \s-1DBI\s0 drivers page? | |
657 | .PP | |
658 | .Vb 2 | |
659 | \& http://dbi.perl.org/ | |
660 | \& http://www.symbolstone.org/technology/perl/DBI | |
661 | .Ve | |
662 | .PP | |
663 | If not, no. A complete absence of a given database driver from that | |
664 | page means that no-one has announced any intention to work on it, not that | |
665 | such a driver is impossible to write. | |
666 | .PP | |
667 | A corollary of the above statement implies that if you see an announcement | |
668 | for a driver \fInot\fR on the above page, there's a good chance it's not | |
669 | actually a \fI\s-1DBI\s0\fR driver, and may not conform to the specifications. Therefore, | |
670 | questions concerning problems with that code should \fInot\fR really be addressed | |
671 | to the \s-1DBI\s0 Mailing Lists. | |
672 | .Sh "3.6 What's \s-1DBM\s0? And why should I use \s-1DBI\s0 instead?" | |
673 | .IX Subsection "3.6 What's DBM? And why should I use DBI instead?" | |
674 | Extracted from ``\fI\s-1DBI\s0 \- The Database Interface for Perl 5\fR'': | |
675 | .PP | |
676 | .Vb 3 | |
677 | \& ``UNIX was originally blessed with simple file-based ``databases'', namely | |
678 | \& the dbm system. dbm lets you store data in files, and retrieve | |
679 | \& that data quickly. However, it also has serious drawbacks. | |
680 | .Ve | |
681 | .PP | |
682 | .Vb 1 | |
683 | \& File Locking | |
684 | .Ve | |
685 | .PP | |
686 | .Vb 3 | |
687 | \& The dbm systems did not allow particularly robust file locking | |
688 | \& capabilities, nor any capability for correcting problems arising through | |
689 | \& simultaneous writes [ to the database ]. | |
690 | .Ve | |
691 | .PP | |
692 | .Vb 1 | |
693 | \& Arbitrary Data Structures | |
694 | .Ve | |
695 | .PP | |
696 | .Vb 4 | |
697 | \& The dbm systems only allows a single fixed data structure: | |
698 | \& key-value pairs. That value could be a complex object, such as a | |
699 | \& [ C ] struct, but the key had to be unique. This was a large | |
700 | \& limitation on the usefulness of dbm systems. | |
701 | .Ve | |
702 | .PP | |
703 | .Vb 5 | |
704 | \& However, dbm systems still provide a useful function for users with | |
705 | \& simple datasets and limited resources, since they are fast, robust and | |
706 | \& extremely well-tested. Perl modules to access dbm systems have now | |
707 | \& been integrated into the core Perl distribution via the | |
708 | \& AnyDBM_File module.'' | |
709 | .Ve | |
710 | .PP | |
711 | To sum up, \s-1DBM\s0 is a perfectly satisfactory solution for essentially read-only | |
712 | databases, or small and simple datasets. However, for more | |
713 | scaleable dataset handling, not to mention robust transactional locking, | |
714 | users are recommended to use a more powerful database engine \fIvia\fR \fI\s-1DBI\s0\fR. | |
715 | .PP | |
716 | Chapter 2 of \*(L"Programming the Perl \s-1DBI\s0\*(R" discusses \s-1DBM\s0 files in detail. | |
717 | .Sh "3.7 What database do you recommend me using?" | |
718 | .IX Subsection "3.7 What database do you recommend me using?" | |
719 | This is a particularly thorny area in which an objective answer is difficult | |
720 | to come by, since each dataset, proposed usage and system configuration | |
721 | differs from person to person. | |
722 | .PP | |
723 | From the current author's point of view, if the dataset is relatively | |
724 | small, being tables of less than 1 million rows, and less than 1000 tables | |
725 | in a given database, then \fImSQL\fR is a perfectly acceptable solution | |
726 | to your problem. This database is extremely cheap, is wonderfully robust | |
727 | and has excellent support. More information is available on the Hughes | |
728 | Technology \s-1WWW\s0 site at: | |
729 | .PP | |
730 | .Vb 1 | |
731 | \& http://www.hughes.com.au | |
732 | .Ve | |
733 | .PP | |
734 | You may also wish to look at MySQL which is a more powerful database engine | |
735 | that has a similar feel to mSQL. | |
736 | .PP | |
737 | .Vb 1 | |
738 | \& http://www.tcx.se | |
739 | .Ve | |
740 | .PP | |
741 | If the dataset is larger than 1 million row tables or 1000 tables, or if you | |
742 | have either more money, or larger machines, I would recommend \fIOracle \s-1RDBMS\s0\fR. | |
743 | Oracle's \s-1WWW\s0 site is an excellent source of more information. | |
744 | .PP | |
745 | .Vb 1 | |
746 | \& http://www.oracle.com | |
747 | .Ve | |
748 | .PP | |
749 | \&\fIInformix\fR is another high-end \s-1RDBMS\s0 that is worth considering. There are | |
750 | several differences between Oracle and Informix which are too complex for | |
751 | this document to detail. Information on Informix can be found on their | |
752 | \&\s-1WWW\s0 site at: | |
753 | .PP | |
754 | .Vb 1 | |
755 | \& http://www.informix.com | |
756 | .Ve | |
757 | .PP | |
758 | In the case of \s-1WWW\s0 fronted applications, \fImSQL\fR may be a better option | |
759 | due to slow connection times between a \s-1CGI\s0 script and the Oracle \s-1RDBMS\s0 and | |
760 | also the amount of resource each Oracle connection will consume. \fImSQL\fR | |
761 | is lighter resource-wise and faster. | |
762 | .PP | |
763 | These views are not necessarily representative of anyone else's opinions, | |
764 | and do not reflect any corporate sponsorship or views. They are provided | |
765 | \&\fIas-is\fR. | |
766 | .Sh "3.8 Is <\fIinsert feature here\fP> supported in \s-1DBI\s0?" | |
767 | .IX Subsection "3.8 Is <insert feature here> supported in DBI?" | |
768 | Given that we're making the assumption that the feature you have requested | |
769 | is a non-standard database-specific feature, then the answer will be \fIno\fR. | |
770 | .PP | |
771 | \&\s-1DBI\s0 reflects a \fIgeneric\fR \s-1API\s0 that will work for most databases, and has | |
772 | no database-specific functionality. | |
773 | .PP | |
774 | However, driver authors may, if they so desire, include hooks to database-specific | |
775 | functionality through the \f(CW\*(C`func()\*(C'\fR method defined in the \s-1DBI\s0 \s-1API\s0. | |
776 | Script developers should note that use of functionality provided \fIvia\fR | |
777 | the \f(CW\*(C`func()\*(C'\fR methods is very unlikely to be portable across databases. | |
778 | .SH "Programming Questions" | |
779 | .IX Header "Programming Questions" | |
780 | .Sh "4.1 Is \s-1DBI\s0 any use for \s-1CGI\s0 programming?" | |
781 | .IX Subsection "4.1 Is DBI any use for CGI programming?" | |
782 | In a word, yes! \s-1DBI\s0 is hugely useful for \s-1CGI\s0 programming! In fact, I would | |
783 | tentatively say that \s-1CGI\s0 programming is one of two top uses for \s-1DBI\s0. | |
784 | .PP | |
785 | \&\s-1DBI\s0 confers the ability to \s-1CGI\s0 programmers to power WWW-fronted databases | |
786 | to their users, which provides users with vast quantities of ordered | |
787 | data to play with. \s-1DBI\s0 also provides the possibility that, if a site is | |
788 | receiving far too much traffic than their database server can cope with, they | |
789 | can upgrade the database server behind the scenes with no alterations to | |
790 | the \s-1CGI\s0 scripts. | |
791 | .Sh "4.2 How do I get faster connection times with DBD::Oracle and \s-1CGI\s0?" | |
792 | .IX Subsection "4.2 How do I get faster connection times with DBD::Oracle and CGI?" | |
793 | .Vb 1 | |
794 | \& Contributed by John D. Groenveld | |
795 | .Ve | |
796 | .PP | |
797 | The Apache \f(CW\*(C`httpd\*(C'\fR maintains a pool of \f(CW\*(C`httpd\*(C'\fR children to service client | |
798 | requests. | |
799 | .PP | |
800 | Using the Apache \fImod_perl\fR module by \fIDoug MacEachern\fR, the perl | |
801 | interpreter is embedded with the \f(CW\*(C`httpd\*(C'\fR children. The \s-1CGI\s0, \s-1DBI\s0, and your | |
802 | other favorite modules can be loaded at the startup of each child. These | |
803 | modules will not be reloaded unless changed on disk. | |
804 | .PP | |
805 | For more information on Apache, see the Apache Project's \s-1WWW\s0 site: | |
806 | .PP | |
807 | .Vb 1 | |
808 | \& http://www.apache.org | |
809 | .Ve | |
810 | .PP | |
811 | The \fImod_perl\fR module can be downloaded from \s-1CPAN\s0 \fIvia\fR: | |
812 | .PP | |
813 | .Vb 1 | |
814 | \& http://www.perl.com/cgi-bin/cpan_mod?module=Apache | |
815 | .Ve | |
816 | .Sh "4.3 How do I get persistent connections with \s-1DBI\s0 and \s-1CGI\s0?" | |
817 | .IX Subsection "4.3 How do I get persistent connections with DBI and CGI?" | |
818 | .Vb 1 | |
819 | \& Contributed by John D. Groenveld | |
820 | .Ve | |
821 | .PP | |
822 | Using Edmund Mergl's \fIApache::DBI\fR module, database logins are stored in a | |
823 | hash with each of these \f(CW\*(C`httpd\*(C'\fR child. If your application is based on a | |
824 | single database user, this connection can be started with each child. | |
825 | Currently, database connections cannot be shared between \f(CW\*(C`httpd\*(C'\fR children. | |
826 | .PP | |
827 | \&\fIApache::DBI\fR can be downloaded from \s-1CPAN\s0 \fIvia\fR: | |
828 | .PP | |
829 | .Vb 1 | |
830 | \& http://www.perl.com/cgi-bin/cpan_mod?module=Apache::DBI | |
831 | .Ve | |
832 | .ie n .Sh "4.4 ``When I run a perl script from the command line, it works, but, when I run it under the ""httpd"", it fails!'' Why?" | |
833 | .el .Sh "4.4 ``When I run a perl script from the command line, it works, but, when I run it under the \f(CWhttpd\fP, it fails!'' Why?" | |
834 | .IX Subsection "4.4 ``When I run a perl script from the command line, it works, but, when I run it under the httpd, it fails!'' Why?" | |
835 | Basically, a good chance this is occurring is due to the fact that the user | |
836 | that you ran it from the command line as has a correctly configured set of | |
837 | environment variables, in the case of \fIDBD::Oracle\fR, variables like | |
838 | \&\f(CW\*(C`ORACLE_HOME\*(C'\fR, \f(CW\*(C`ORACLE_SID\*(C'\fR or \f(CW\*(C`TWO_TASK\*(C'\fR. | |
839 | .PP | |
840 | The \f(CW\*(C`httpd\*(C'\fR process usually runs under the user id of \f(CW\*(C`nobody\*(C'\fR, | |
841 | which implies there is no configured environment. Any scripts attempting to | |
842 | execute in this situation will correctly fail. | |
843 | .PP | |
844 | One way to solve this problem is to set the environment for your database in a | |
845 | \&\f(CW\*(C`BEGIN { }\*(C'\fR block at the top of your script. Another technique is to configure | |
846 | your \s-1WWW\s0 server to pass-through certain environment variables to your \s-1CGI\s0 | |
847 | scripts. | |
848 | .PP | |
849 | Similarly, you should check your \f(CW\*(C`httpd\*(C'\fR error logfile for any clues, | |
850 | as well as the ``Idiot's Guide To Solving Perl / \s-1CGI\s0 Problems'' and | |
851 | ``Perl \s-1CGI\s0 Programming \s-1FAQ\s0'' for further information. It is | |
852 | unlikely the problem is DBI\-related. | |
853 | .PP | |
854 | The ``Idiot's Guide To Solving Perl / \s-1CGI\s0 Problems'' can be located at: | |
855 | .PP | |
856 | .Vb 1 | |
857 | \& http://www.perl.com/perl/faq/index.html | |
858 | .Ve | |
859 | .PP | |
860 | as can the ``Perl \s-1CGI\s0 Programming \s-1FAQ\s0''. Read \fI\s-1BOTH\s0\fR these documents | |
861 | carefully! | |
862 | .ie n .Sh "4.5 How do I get the number of rows returned from a ""SELECT"" statement?" | |
863 | .el .Sh "4.5 How do I get the number of rows returned from a \f(CWSELECT\fP statement?" | |
864 | .IX Subsection "4.5 How do I get the number of rows returned from a SELECT statement?" | |
865 | Count them. Read the \s-1DBI\s0 docs for the \f(CW\*(C`rows()\*(C'\fR method. | |
866 | .SH "Miscellaneous Questions" | |
867 | .IX Header "Miscellaneous Questions" | |
868 | .Sh "5.1 Can I do multi-threading with \s-1DBI\s0?" | |
869 | .IX Subsection "5.1 Can I do multi-threading with DBI?" | |
870 | Perl version 5.005 and later can be built to support multi\-threading. | |
871 | The \s-1DBI\s0, as of version 1.02, does not yet support multi-threading | |
872 | so it would be unsafe to let more than one thread enter the \s-1DBI\s0 at | |
873 | the same time. | |
874 | .PP | |
875 | It is expected that some future version of the \s-1DBI\s0 will at least be | |
876 | thread-safe (but not thread\-hot) by automatically blocking threads | |
877 | intering the \s-1DBI\s0 while it's already in use. | |
878 | .PP | |
879 | For some \s-1OCI\s0 example code for Oracle that has multi-threaded \f(CW\*(C`SELECT\*(C'\fR | |
880 | statements, see: | |
881 | .PP | |
882 | .Vb 1 | |
883 | \& http://www.symbolstone.org/technology/oracle/oci/orathreads.tar.gz | |
884 | .Ve | |
885 | .Sh "5.2 How do I handle \s-1BLOB\s0 data with \s-1DBI\s0?" | |
886 | .IX Subsection "5.2 How do I handle BLOB data with DBI?" | |
887 | Handling \s-1BLOB\s0 data with the \s-1DBI\s0 is very straight\-forward. \s-1BLOB\s0 columns are | |
888 | specified in a \s-1SELECT\s0 statement as per normal columns. However, you also | |
889 | need to specify a maximum \s-1BLOB\s0 size that the <I>database handle</I> can | |
890 | fetch using the \f(CW\*(C`LongReadLen\*(C'\fR attribute. | |
891 | .PP | |
892 | For example: | |
893 | .PP | |
894 | .Vb 3 | |
895 | \& ### $dbh is a connected database handle | |
896 | \& $sth = $dbh->prepare( "SELECT blob_column FROM blobby_table" ); | |
897 | \& $sth->execute; | |
898 | .Ve | |
899 | .PP | |
900 | would fail. | |
901 | .PP | |
902 | .Vb 3 | |
903 | \& ### $dbh is a connected database handle | |
904 | \& ### Set the maximum BLOB size... | |
905 | \& $dbh->{LongReadLen} = 16384; ### 16Kb...Not much of a BLOB! | |
906 | .Ve | |
907 | .PP | |
908 | .Vb 1 | |
909 | \& $sth = $dbh->prepare( "..." ); | |
910 | .Ve | |
911 | .PP | |
912 | would succeed <I>provided no column values were larger than the specified | |
913 | value</I>. | |
914 | .PP | |
915 | If the \s-1BLOB\s0 data is longer than the value of \f(CW\*(C`LongReadLen\*(C'\fR, then an | |
916 | error will occur. However, the \s-1DBI\s0 provides an additional piece of | |
917 | functionality that will automatically truncate the fetched \s-1BLOB\s0 to the | |
918 | size of \f(CW\*(C`LongReadLen\*(C'\fR if it is longer. This does not cause an error to | |
919 | occur, but may make your fetched \s-1BLOB\s0 data useless. | |
920 | .PP | |
921 | This behaviour is regulated by the \f(CW\*(C`LongTruncOk\*(C'\fR attribute which is | |
922 | defaultly set to a false value ( thus making overlong \s-1BLOB\s0 fetches fail ). | |
923 | .PP | |
924 | .Vb 3 | |
925 | \& ### Set BLOB handling such that it's 16Kb and can be truncated | |
926 | \& $dbh->{LongReadLen} = 16384; | |
927 | \& $dbh->{LongTruncOk} = 1; | |
928 | .Ve | |
929 | .PP | |
930 | Truncation of \s-1BLOB\s0 data may not be a big deal in cases where the \s-1BLOB\s0 | |
931 | contains run-length encoded data, but data containing checksums at the end, | |
932 | for example, a \s-1ZIP\s0 file, would be rendered useless. | |
933 | .Sh "5.3 How can I invoke stored procedures with \s-1DBI\s0?" | |
934 | .IX Subsection "5.3 How can I invoke stored procedures with DBI?" | |
935 | The \s-1DBI\s0 does not define a database-independent way of calling stored procedures. | |
936 | .PP | |
937 | However, most database that support them also provide a way to call | |
938 | them from \s-1SQL\s0 statements \- and the \s-1DBI\s0 certainly supports that. | |
939 | .PP | |
940 | So, assuming that you have created a stored procedure within the target | |
941 | database, \fIeg\fR, an Oracle database, you can use \f(CW$dbh\fR\->\f(CW\*(C`do()\*(C'\fR to | |
942 | immediately execute the procedure. For example, | |
943 | .PP | |
944 | .Vb 1 | |
945 | \& $dbh->do( "BEGIN someProcedure; END;" ); # Oracle-specific | |
946 | .Ve | |
947 | .PP | |
948 | You should also be able to \f(CW\*(C`prepare\*(C'\fR and \f(CW\*(C`execute\*(C'\fR, which is | |
949 | the recommended way if you'll be calling the procedure often. | |
950 | .Sh "5.4 How can I get return values from stored procedures with \s-1DBI\s0?" | |
951 | .IX Subsection "5.4 How can I get return values from stored procedures with DBI?" | |
952 | .Vb 1 | |
953 | \& Contributed by Jeff Urlwin | |
954 | .Ve | |
955 | .PP | |
956 | .Vb 5 | |
957 | \& $sth = $dbh->prepare( "BEGIN foo(:1, :2, :3); END;" ); | |
958 | \& $sth->bind_param(1, $a); | |
959 | \& $sth->bind_param_inout(2, \e$path, 2000); | |
960 | \& $sth->bind_param_inout(3, \e$success, 2000); | |
961 | \& $sth->execute; | |
962 | .Ve | |
963 | .PP | |
964 | Remember to perform error checking, though! ( Or use the \f(CW\*(C`RaiseError\*(C'\fR | |
965 | attribute ). | |
966 | .Sh "5.5 How can I create or drop a database with \s-1DBI\s0?" | |
967 | .IX Subsection "5.5 How can I create or drop a database with DBI?" | |
968 | Database creation and deletion are concepts that are entirely too abstract | |
969 | to be adequately supported by \s-1DBI\s0. For example, Oracle does not support the | |
970 | concept of dropping a database at all! Also, in Oracle, the database | |
971 | \&\fIserver\fR essentially \fIis\fR the database, whereas in mSQL, the | |
972 | server process runs happily without any databases created in it. The | |
973 | problem is too disparate to attack in a worthwhile way. | |
974 | .PP | |
975 | Some drivers, therefore, support database creation and deletion through | |
976 | the private \f(CW\*(C`func()\*(C'\fR methods. You should check the documentation for | |
977 | the drivers you are using to see if they support this mechanism. | |
978 | .ie n .Sh "5.6 How can I ""commit""\fP or \f(CW""rollback"" a statement with \s-1DBI\s0?" | |
979 | .el .Sh "5.6 How can I \f(CWcommit\fP or \f(CWrollback\fP a statement with \s-1DBI\s0?" | |
980 | .IX Subsection "5.6 How can I commit or rollback a statement with DBI?" | |
981 | See the \f(CW\*(C`commit()\*(C'\fR and \f(CW\*(C`rollback()\*(C'\fR methods in the \s-1DBI\s0 Specification. | |
982 | .PP | |
983 | Chapter 6 of \*(L"Programming the Perl \s-1DBI\s0\*(R" discusses transaction handling within | |
984 | the context of \s-1DBI\s0 in more detail. | |
985 | .ie n .Sh "5.7 How are ""NULL"" values handled by \s-1DBI\s0?" | |
986 | .el .Sh "5.7 How are \f(CWNULL\fP values handled by \s-1DBI\s0?" | |
987 | .IX Subsection "5.7 How are NULL values handled by DBI?" | |
988 | \&\f(CW\*(C`NULL\*(C'\fR values in \s-1DBI\s0 are specified to be treated as the value \f(CW\*(C`undef\*(C'\fR. | |
989 | \&\f(CW\*(C`NULL\*(C'\fRs can be inserted into databases as \f(CW\*(C`NULL\*(C'\fR, for example: | |
990 | .PP | |
991 | .Vb 1 | |
992 | \& $rv = $dbh->do( "INSERT INTO table VALUES( NULL )" ); | |
993 | .Ve | |
994 | .PP | |
995 | but when queried back, the \f(CW\*(C`NULL\*(C'\fRs should be tested against \f(CW\*(C`undef\*(C'\fR. | |
996 | This is standard across all drivers. | |
997 | .ie n .Sh "5.8 What are these ""func()"" methods all about?" | |
998 | .el .Sh "5.8 What are these \f(CWfunc()\fP methods all about?" | |
999 | .IX Subsection "5.8 What are these func() methods all about?" | |
1000 | The \f(CW\*(C`func()\*(C'\fR method is defined within \s-1DBI\s0 as being an entry point | |
1001 | for database-specific functionality, \fIeg\fR, the ability to create or | |
1002 | drop databases. Invoking these driver-specific methods is simple, for example, | |
1003 | to invoke a \f(CW\*(C`createDatabase\*(C'\fR method that has one argument, we would | |
1004 | write: | |
1005 | .PP | |
1006 | .Vb 1 | |
1007 | \& $rv =$dbh->func( 'argument', 'createDatabase' ); | |
1008 | .Ve | |
1009 | .PP | |
1010 | Software developers should note that the \f(CW\*(C`func()\*(C'\fR methods are | |
1011 | non-portable between databases. | |
1012 | .Sh "5.9 Is \s-1DBI\s0 Year 2000 Compliant?" | |
1013 | .IX Subsection "5.9 Is DBI Year 2000 Compliant?" | |
1014 | \&\s-1DBI\s0 has no knowledge of understanding of what dates are. Therefore, \s-1DBI\s0 | |
1015 | itself does not have a Year 2000 problem. Individual drivers may use date | |
1016 | handling code internally and therefore be potentially susceptible to the | |
1017 | Year 2000 problem, but this is unlikely. | |
1018 | .PP | |
1019 | You may also wish to read the ``Does Perl have a Year 2000 problem?'' section | |
1020 | of the Perl \s-1FAQ\s0 at: | |
1021 | .PP | |
1022 | .Vb 1 | |
1023 | \& http://www.perl.com/CPAN/doc/FAQs/FAQ/PerlFAQ.html | |
1024 | .Ve | |
1025 | .SH "Support and Training" | |
1026 | .IX Header "Support and Training" | |
1027 | The Perl5 Database Interface is \fI\s-1FREE\s0\fR software. \s-1IT\s0 \s-1COMES\s0 \s-1WITHOUT\s0 \s-1WARRANTY\s0 | |
1028 | \&\s-1OF\s0 \s-1ANY\s0 \s-1KIND\s0. See the \s-1DBI\s0 \s-1README\s0 for more details. | |
1029 | .PP | |
1030 | However, some organizations are providing either technical support or | |
1031 | training programs on \s-1DBI\s0. The present author has no knowledge as | |
1032 | to the quality of these services. The links are included for reference | |
1033 | purposes only and should not be regarded as recommendations in any way. | |
1034 | \&\fICaveat emptor\fR. | |
1035 | .Sh "Commercial Support" | |
1036 | .IX Subsection "Commercial Support" | |
1037 | .IP "The Perl Clinic" 4 | |
1038 | .IX Item "The Perl Clinic" | |
1039 | The Perl Clinic provides commercial support for \fIPerl\fR and Perl | |
1040 | related problems, including the \fI\s-1DBI\s0\fR and its drivers. Support is | |
1041 | provided by the company with whom Tim Bunce, author of \fI\s-1DBI\s0\fR and | |
1042 | \&\fIDBD::Oracle\fR, works and ActiveState. For more information on their | |
1043 | services, please see: | |
1044 | .Sp | |
1045 | .Vb 1 | |
1046 | \& http://www.perlclinic.com | |
1047 | .Ve | |
1048 | .Sh "Training" | |
1049 | .IX Subsection "Training" | |
1050 | .IP "Westlake Solutions" 4 | |
1051 | .IX Item "Westlake Solutions" | |
1052 | A hands-on class for experienced Perl \s-1CGI\s0 developers that teaches | |
1053 | how to write database-connected \s-1CGI\s0 scripts using Perl and \s-1DBI\s0.pm. This | |
1054 | course, along with four other courses on \s-1CGI\s0 scripting with Perl, is | |
1055 | taught in Washington, \s-1DC\s0; Arlington, Virginia; and on-site worldwide upon | |
1056 | request. | |
1057 | .Sp | |
1058 | See: | |
1059 | .Sp | |
1060 | .Vb 1 | |
1061 | \& http://www.westlake.com/training | |
1062 | .Ve | |
1063 | .Sp | |
1064 | for more details. | |
1065 | .SH "Other References" | |
1066 | .IX Header "Other References" | |
1067 | In this section, we present some miscellaneous \s-1WWW\s0 links that may be of | |
1068 | some interest to \s-1DBI\s0 users. These are not verified and may result in | |
1069 | unknown sites or missing documents. | |
1070 | .PP | |
1071 | .Vb 3 | |
1072 | \& http://www-ccs.cs.umass.edu/db.html | |
1073 | \& http://www.odmg.org/odmg93/updates_dbarry.html | |
1074 | \& http://www.jcc.com/sql_stnd.html | |
1075 | .Ve | |
1076 | .SH "AUTHOR" | |
1077 | .IX Header "AUTHOR" | |
1078 | Alligator Descartes <\fIhttp://www.symbolstone.org/descarte/contact.html\fR>. | |
1079 | Portions are Copyright their original stated authors. | |
1080 | .SH "COPYRIGHT" | |
1081 | .IX Header "COPYRIGHT" | |
1082 | This document is Copyright (c)1994\-2000 Alligator Descartes, with portions | |
1083 | Copyright (c)1994\-2000 their original authors. This module is released under | |
1084 | the 'Artistic' license which you can find in the perl distribution. | |
1085 | .PP | |
1086 | This document is Copyright (c)1997\-2000 Alligator Descartes. All rights reserved. | |
1087 | Permission to distribute this document, in full or in part, via email, | |
1088 | Usenet, ftp archives or http is granted providing that no charges are involved, | |
1089 | reasonable attempt is made to use the most current version and all credits | |
1090 | and copyright notices are retained ( the \fI\s-1AUTHOR\s0\fR and \fI\s-1COPYRIGHT\s0\fR sections ). | |
1091 | Requests for other distribution rights, including incorporation into | |
1092 | commercial products, such as books, magazine articles or CD-ROMs should be | |
1093 | made to Alligator Descartes <\fIhttp://www.symbolstone.org/descarte/contact.html\fR>. |