home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / DBI / FAQ.pm < prev    next >
Encoding:
Perl POD Document  |  1997-08-10  |  31.2 KB  |  883 lines

  1. ###
  2. ### $Id: FAQ.pm,v 1.5 1997/07/15 10:58:27 timbo Exp $
  3. ###
  4. ### DBI Frequently Asked Questions POD
  5. ###
  6. ### Copyright section reproduced from below.
  7. ###
  8. ### This document is Copyright (c)1994-1997 Alligator Descartes, with portions
  9. ### Copyright (c)1994-1997 their original authors. This module is released under
  10. ### the 'Artistic' license which you can find in the perl distribution.
  11. ### 
  12. ### This document is Copyright (c)1997 Alligator Descartes. All rights reserved.
  13. ### Permission to distribute this document, in full or in part, via email,
  14. ### Usenet, ftp archives or http is granted providing that no charges are involved,
  15. ### reasonable attempt is made to use the most current version and all credits
  16. ### and copyright notices are retained ( the I<AUTHOR> and I<COPYRIGHT> sections ).
  17. ### Requests for other distribution rights, including incorporation into 
  18. ### commercial products, such as books, magazine articles or CD-ROMs should be
  19. ### made to Alligator Descartes <I<descarte@hermetica.com>>.
  20. ### 
  21. ### $Log: FAQ.pm,v $
  22. # Revision 1.5  1997/07/15  10:58:27  timbo
  23. # *** empty log message ***
  24. #
  25. # Revision 1.4  1997/06/25  12:20:10  timbo
  26. # *** empty log message ***
  27. #
  28.  
  29. package DBI::FAQ;
  30.  
  31. =head1 NAME
  32.  
  33. DBI::FAQ -- The Frequently Asked Questions for the Perl5 Database Interface
  34.  
  35. =for html
  36. <HTML>
  37. <HEAD>
  38. <!-- -->
  39. <!-- $Id: FAQ.pm,v 1.5 1997/07/15 10:58:27 timbo Exp $ -->
  40. <!-- -->
  41. <TITLE>Frequently Asked Questions for DBI</TITLE>
  42. </HEAD>
  43. <BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#3a15ff" ALINK="#ff0000" VLINK="#ff282d">
  44. <CENTER>
  45. <IMG SRC="/img/hermlogo.gif" WIDTH=437 HEIGHT=115 ALT="[ Hermetica ]">
  46. </CENTER>
  47. <HR>
  48. <P>
  49. <CENTER>
  50. <FONT SIZE="+2">
  51. DBI Frequently Asked Questions v.0.35
  52. </FONT>
  53. <BR>
  54. <FONT SIZE="-1">
  55. <I>Last updated: June 20th, 1997</I>
  56. </FONT>
  57. </CENTER>
  58. <P>
  59.  
  60. =head1 SYNOPSIS
  61.  
  62.     perldoc DBI::FAQ
  63.  
  64. =head1 VERSION
  65.  
  66. This document is currently at version I<0.35>, as of I<June 20th, 1997>.
  67.  
  68. =head1 DESCRIPTION
  69.  
  70. This document serves to answer the most frequently asked questions on both
  71. the DBI Mailing Lists and personally to members of the DBI development team.
  72.  
  73. =head1 Basic Information & Information Sources
  74.  
  75. =head2 1.1 What is DBI, DBperl, Oraperl and *perl?
  76.  
  77. To quote Tim Bunce, the architect and author of DBI:
  78.  
  79.     ``DBI is a database access Application Programming Interface (API)
  80.       for the Perl Language. The DBI API Specification defines a set
  81.       of functions, variables and conventions that provide a consistent
  82.       database interface independant of the actual database being used.''
  83.  
  84. In simple language, the DBI interface allows users to access multiple database
  85. types transparently. So, if you connecting to an Oracle, Informix, mSQL, Sybase
  86. or whatever database, you don't need to know the underlying mechanics of the
  87. interface. The API defined by DBI will work on I<all> these database types.
  88.  
  89. A similar benefit is gained by the ability to connect to two I<different>
  90. databases of different vendor within the one perl script, I<ie>, I want
  91. to read data from an Oracle database and insert it back into an Informix
  92. database all within one program. The DBI layer allows you to do this simply
  93. and powerfully.
  94.  
  95.  
  96. =for html
  97. Here's a diagram that demonstrates the principle:
  98. <P>
  99. <CENTER>
  100. <IMG SRC="img/dbiarch.gif" WIDTH=451 HEIGHT=321 ALT="[ DBI Architecture ]">
  101. </CENTER>
  102. <P>
  103.  
  104. I<DBperl> is the old name for the interface specification. It's usually
  105. now used to denote perlI<4> modules on database interfacing, such as,
  106. I<oraperl>, I<isqlperl>, I<ingperl> and so on. These interfaces
  107. didn't have a standard API and are generally I<not> supported.
  108.  
  109. Here's a list of old DBperl's, their corresponding DBI counterparts and
  110. support information. I<Please note>, the author's listed here generally
  111. I<do not> maintain the DBI module for the same database. These email
  112. addresses are unverified and should only be used for queries concerning the
  113. perl4 modules listed below. DBI driver queries should be directed to the
  114. I<dbi-users> mailing list.
  115.  
  116.   Perl4 Name  Database          Author                  DBI Driver
  117.   ----------  --------          ------                  ----------
  118.   Sybperl     Sybase            Michael Peppler         DBD::Sybase
  119.                                 <mpeppler@itf.ch>
  120.   Oraperl     Oracle 6 & 7      Kevin Stock             DBD::Oracle
  121.                                 <dbi-users@fugue.com>
  122.   Ingperl     Ingres            Tim Bunce &             DBD::Ingres
  123.                                 Ted Lemon
  124.                                 <dbi-users@fugue.com>
  125.   Interperl   Interbase         Buzz Moschetti          DBD::Interbase
  126.                                 <buzz@bear.com>
  127.   Uniperl     Unify 5.0         Rick Wargo              None
  128.                                 <rickers@coe.drexel.edu>
  129.   Pgperl      Postgres          Igor Metz               DBD::Pg
  130.                                 <metz@iam.unibe.ch>
  131.   Btreeperl   NDBM              John Conover            SDBM?
  132.                                 <john@johncon.com>
  133.   Ctreeperl   C-Tree            John Conover            None
  134.                                 <john@johncon.com>
  135.   Cisamperl   Informix C-ISAM   Mathias Koerber         None
  136.                                 <mathias@unicorn.swi.com.sg>
  137.   Duaperl     X.500 Directory   Eric Douglas            None
  138.               User Agent
  139.  
  140. However, some DBI modules have DBperl emulation layers, so, I<DBD::Oracle>
  141. for example comes with an Oraperl emulation layer, which allows you to
  142. run legacy oraperl scripts without modification. The emulation layer
  143. translates the oraperl API calls into the corresponding DBI calls.
  144.  
  145. Here's a table of emulation layer information:
  146.  
  147.     Module          Emulation Layer     Status
  148.     ------          ---------------     ------
  149.     DBD::Oracle     Oraperl             Complete
  150.     DBD::Ingres     Ingperl             Complete
  151.     DBD::Informix   Isqlperl            Under development
  152.     DBD::Sybase     Sybperl             Working? ( Needs verification )
  153.     DBD::mSQL       Msqlperl            Experimentally released with 
  154.                                         DBD::mSQL-0.61
  155.  
  156. The I<Msqlperl> emulation is a special case. I<Msqlperl> is a perl5 driver
  157. for I<mSQL> databases, but does not conform to the DBI Specification. It's
  158. use is being deprecated in favour of I<DBD::mSQL>. I<Msqlperl> may be downloaded
  159. from CPAN I<via>:
  160.  
  161.     http://www.perl.com/cgi-bin/cpan_mod?module=Msqlperl
  162.  
  163. =head2 1.2. Where can I get it from?
  164.  
  165. DBI is primarily distributed from:
  166.  
  167.     ftp://ftp.demon.co.uk/pub/perl/db
  168.  
  169. The Comprehensive Perl Archive Network resources should be used for
  170. retrieving up-to-date versions of the drivers.  Local CPAN sites may be
  171. accessed I<via> Tom Christiansen's splendid I<CPAN multiplexer> program
  172. located at:
  173.  
  174.     http://www.perl.com/CPAN/
  175.  
  176. For more specific version information and exact URLs of drivers, please see
  177. the DBI drivers list and the DBI module pages which can be found on:
  178.  
  179.     http://www.hermetica.com/technologia/perl/DBI
  180.  
  181. =head2 1.3. Where can I get more information?
  182.  
  183. There are a few information sources on DBI. 
  184.  
  185. =over 4
  186.  
  187. =item I<DBI Specification>
  188.  
  189.     http://www.hermetica.com/technologia/perl/DBI/doc/dbispec
  190.  
  191. There are two specifications available at this link, the new DBI Draft
  192. Specification which is a rapidly evolving document as Tim Bunce and the
  193. development team drive towards a stable interface, and the old
  194. historical DBperl Specification out of which the current DBI interface
  195. evolved.
  196.  
  197. The latter document should be regarded as being of historical interest 
  198. only and should not serve as a programming manual, or authoratative in any 
  199. sense. However, it is still a very useful reference source.
  200.  
  201. =item I<POD documentation>
  202.  
  203. I<POD>s are chunks of documentation usually embedded within perl programs
  204. that document the code ``I<in place>'', providing a useful resource for
  205. programmers and users of modules. POD for DBI and drivers is beginning to 
  206. become more commonplace, and documentation for these modules can be read
  207. with the following commands.
  208.  
  209. =over 4 
  210.  
  211. =item The DBI Specification
  212.  
  213. The POD for the DBI Specification can be read with the:
  214.  
  215.     perldoc DBI
  216.  
  217. command.
  218.  
  219. =item Frequently Asked Questions
  220.  
  221. This document, the I<Frequently Asked Questions> is also available as POD
  222. documentation! You can read this on your own system by typing:
  223.  
  224.     perldoc DBI::FAQ
  225.  
  226. This may be more convenient to persons not permanently, or conveniently,
  227. connected to the Internet but the document may not be the latest version.
  228.  
  229. =item Oraperl
  230.  
  231. Users of the Oraperl emulation layer bundled with I<DBD::Oracle>, may read
  232. up on how to program with the Oraperl interface by typing:
  233.  
  234.     perldoc Oraperl
  235.  
  236. This will produce an updated copy of the original oraperl man page written by
  237. Kevin Stock for perl4. The oraperl API is fully listed and described there.
  238.  
  239. =item DBD::mSQL
  240.  
  241. Users of the I<DBD::mSQL> module may read about some of the private functions
  242. and quirks of that driver by typing:
  243.  
  244.     perldoc DBD::mSQL
  245.  
  246. =item POD in general
  247.  
  248. Information on writing POD, and on the philosophy of POD in general, can be
  249. read by typing:
  250.  
  251.     perldoc perlpod
  252.  
  253. Users with the Tk module installed may be interested to learn there is a
  254. Tk-based POD reader available called C<tkpod>, which formats POD in a convenient
  255. and readable way.
  256.  
  257. =back
  258.  
  259. =item I<Rambles, Tidbits and Observations>
  260.  
  261.     http://www.hermetica.com/technologia/perl/DBI/tidbits
  262.  
  263. There are a series of occasional rambles from various people on the
  264. DBI mailing lists who, in an attempt to clear up a simple point, end up
  265. drafting fairly comprehensive documents. These are quite often varying in
  266. quality, but do provide some insights into the workings of the interfaces.
  267.  
  268. =item I<``DBI -- The perl5 Database Interface''>
  269.  
  270. This is an article written by Alligator Descartes and Tim Bunce on the
  271. structure of DBI. It was published in issue 5 of ``I<The Perl Journal>''. 
  272. It's I<extremely> good. Go buy the magazine. In fact, buy all of them! 
  273. ``The Perl Journal''s WWW site is:
  274.  
  275.     http://www.tpj.com
  276.  
  277. =item I<``DBperl''>
  278.  
  279. This article, published in the November 1996 edition of ``Dr. Dobbs
  280. Journal'' concerned I<DBperl>. The author of this edition apparently did
  281. not bother to contact any of the DBI development team members for verification
  282. of the information contained within his article. Several reviews of the
  283. article on the I<dbi-users> mailing list were disparaging, to say the least.
  284. The fact the article was written about I<DBperl> instead of I<DBI> hints
  285. at the staleness of the information.  However, we include the reference
  286. for completeness' sake.
  287.  
  288. =item I<``The Perl5 Database Interface''>
  289.  
  290. This item is a book to be written by Alligator Descartes ( for it is me )
  291. and published by O'Reilly and Associates this coming Winter. 
  292.  
  293. Here is the putative table of contents for the book.
  294.  
  295.      * Introduction
  296.           + Databases
  297.           + CGI / WWW
  298.           + perl
  299.      * Basic Database Concepts
  300.           + Types of Database
  301.                o Flat File
  302.                o AnyDBM
  303.                o RDBMS
  304.           + Using Which Database For What...
  305.      * SQL
  306.           + Why SQL?
  307.           + Structuring Information In Databases
  308.           + Retrieving Data From Databases
  309.           + Manipulating Data and Data Structures
  310.      * DBI Architecture
  311.      * Programming with DBI
  312.           + DBI Initialization
  313.           + Handles
  314.                o Driver Handles
  315.                o Database Handles
  316.                o Statement Handles
  317.           + Connection and Disconnection
  318.           + Handling Errors
  319.           + Issuing Simple Queries
  320.           + Executing Atomic Statements
  321.           + Statement MetaData
  322.           + More perl-ish Statements
  323.           + Binding
  324.           + Transaction Handling
  325.           + Utility Methods
  326.           + Handle Attributes and Dynamic Variables
  327.      * DBI and ODBC
  328.      * The Database Drivers
  329.           + DBD::Oracle and oraperl
  330.           + DBD::Informix and isqlperl
  331.           + DBD::mSQL and Msqlperl
  332.      * Case Studies
  333.           + DBI and the WWW
  334.           + Data Migration and Warehousing
  335.           + Administration Software
  336.      * Appendix: API Reference / Specification
  337.      * Appendix: Resources
  338.  
  339. =item I<README files>
  340.  
  341. The I<README> files included with each driver occasionally contains 
  342. some very useful information ( no, really! ) that may be pertinent to the user.
  343. Please read them. It makes our worthless existences more bearable. These
  344. can all be read from the main DBI WWW page at:
  345.  
  346.     http://www.hermetica.com/technologia/perl/DBI
  347.  
  348. =item I<Mailing Lists>
  349.  
  350. There are three mailing lists for DBI run by Ted Lemon. These can all
  351. be subscribed to and unsubscribed from I<via> the World Wide Web at the
  352. URL of:
  353.  
  354.     http://www.fugue.com/dbi
  355.  
  356. If you cannot successfully use the WWW form on the above page, please
  357. subscribe to the list in the following manner:
  358.  
  359.     Email: 'dbi-XXX-request@fugue.com' with a message body of
  360.     'subscribe'
  361.  
  362. Where 'dbi-XXX' is the name of the mailing list you are interested in.
  363. But note that your request will be handled by a human and may take some
  364. time.
  365.  
  366. The lists that users may participate in are:
  367.  
  368. =over 4
  369.  
  370. =item I<dbi-announce>
  371.  
  372. This mailing list is for announcements only. Very low traffic. The
  373. announcements are usually posted on the main DBI WWW page.
  374.  
  375. =item I<dbi-dev>
  376.  
  377. This mailing list is intended for the use of developers discussing
  378. ideas and concepts for the DBI interface, API and driver mechanics.
  379. Only any use for developers, or interested parties. Low traffic.
  380.  
  381. =item I<dbi-users>
  382.  
  383. This mailing list is a general discussion list used for bug reporting,
  384. problem discussion and general enquiries. Medium traffic.
  385.  
  386. =back
  387.  
  388. =item I<Mailing List Archives>
  389.  
  390. =over 4
  391.  
  392. =item I<US Mailing List Archives>
  393.  
  394.     http://outside.organic.com/mail-archives/dbi-users/
  395.  
  396. Searchable hypermail archives of the three mailing lists, and some of the
  397. much older traffic have been set up for users to browse.
  398.  
  399. =item I<European Mailing List Archives>
  400.  
  401.     http://www.rosat.mpe-garching.mpg.de/mailing-lists/PerlDB-Interest
  402.  
  403. As per the US archive above.
  404.  
  405. =back
  406.  
  407. =back
  408.  
  409. =head1 Compilation Problems
  410.  
  411. =head2 2.1. Compilation problems or "It fails the test!"
  412.  
  413. First off, consult the online information about the module, beit
  414. DBI itself, or a DBD, and see if it's a known compilation problem on your
  415. architecture. These documents can be found at:
  416.  
  417.     http://www.hermetica.com/technologia/perl/DBI
  418.  
  419. If it's a known problem, you'll probably have to wait till it gets fixed. If 
  420. you're I<really> needing it fixed, try the following:
  421.  
  422. =over 4
  423.  
  424. =item I<Attempt to fix it yourself>
  425.  
  426. This technique is generally I<not> recommended to the faint-hearted.
  427. If you do think you have managed to fix it, then, send a patch file
  428. ( context diff ) to the author with an explanation of:
  429.  
  430. =over 4
  431.  
  432. =item *
  433.  
  434. What the problem was, and test cases, if possible.
  435.  
  436. =item *
  437.  
  438. What you needed to do to fix it. Please make sure you mention everything.
  439.  
  440. =item *
  441.  
  442. Platform information, database version, perl version (C<perl -V>), module
  443. version and DBI version.
  444.  
  445. =back
  446.  
  447. =item I<Email the author> Do I<NOT> whinge!
  448.  
  449. Please email the address listed in the WWW pages for whichever driver you
  450. are having problems with. Do I<not> directly email the author at a
  451. known address unless it corresponds with the one listed. Some authors,
  452. including Tim Bunce, specifically do not want mail sent directly to them.
  453.  
  454. We tend to have real jobs to do, and we do read the mailing lists for
  455. problems. Besides, we may not have access to <I<insert your
  456. favourite brain-damaged platform here>> and couldn't be of any
  457. assistance anyway! Apologies for sounding harsh, but that's the way of it!
  458.  
  459. However, you might catch one of these creative genii at 3am when we're
  460. doing this sort of stuff anyway, and get a patch within 5 minutes. The
  461. atmosphere in the DBI circle is that we I<do> appreciate the users'
  462. problems, since we work in similar environments.
  463.  
  464. If you are planning to email the author, please furnish as much information
  465. as possible, I<ie>:
  466.  
  467. =over 4
  468.  
  469. =item *
  470.  
  471. I<ALL> the information asked for in the README file for
  472. the problematic module. And we mean I<ALL> of it. We don't
  473. put lines like that in documentation for the good of our health, or
  474. to meet obscure README file standards of length.
  475.  
  476. =item *
  477.  
  478. If you have a core dump, try the I<Devel::CoreStack> module for
  479. generating a stack trace from the core dump. Send us that too.
  480. I<Devel::CoreStack> can be found on CPAN at:
  481.  
  482.     http://www.perl.com/cgi-bin/cpan_mod?module=Devel::CoreStack
  483.  
  484. =item *
  485.  
  486. Module versions, perl version, test cases, operating system versions
  487. and I<any other pertinent information>.
  488.  
  489. =back
  490.  
  491. Remember, the more information you send us, the quicker we can track 
  492. problems down. If you send us no useful information, expect nothing back.
  493.  
  494. =item I<Email the dbi-users Mailing List>
  495.  
  496. It's usually a fairly intelligent idea to I<cc> the mailing list
  497. anyway with problems. The authors all read the lists, so you lose nothing
  498. by mailing there.
  499.  
  500. =back
  501.  
  502. =head1 Platform and Driver Issues
  503.  
  504. =head2 3.1 What's the difference between ODBC and DBI?
  505.  
  506. Good question! To be filled in more detail! Meanwhile see the notes at the
  507. end of the DBI README file.
  508.  
  509. =head2 3.2 Is DBI supported under Windows 95 / NT platforms?
  510.  
  511. Finally, yes! Jeff Urlwin has been working diligently on building
  512. I<DBI> and I<DBD::Oracle> under these platforms, and, with the
  513. advent of a stabler perl and a port of I<MakeMaker>, the project has
  514. come on by great leaps and bounds.
  515.  
  516. Recent I<DBI> and I<DBD::Oracle> modules will build and work out-of-the-box
  517. on Win32 with the standard perl 5.004 (or later) version of perl.
  518.  
  519. If you have to use the old non-standard ActiveWare perl port you can't use
  520. the standard DBI and DBD::Oracle modules out-of-the-box. Details of the 
  521. changes required and pre-patched versions can be found at:
  522.  
  523.     http://www.hermetica.com/technologia/perl/DBI/win32
  524.  
  525. =head2 3.3 Can I access Microsoft Access or SQL-Server databases with DBI?
  526.  
  527.     Contributed by Tim Bunce and Jeff Urlwin
  528.  
  529. Supplied with DBI-0.79 ( and later ) is an experimental DBI 'emulation layer'
  530. for the I<Win32::ODBC> module. It's called I<DBI::W32ODBC> and is,
  531. at the moment, very minimal. You will need the I<Win32::ODBC> module 
  532. available from:
  533.  
  534.     http://www.roth.net
  535.  
  536. Given its status, problem reports without fixes are likely to be ignored. 
  537. You will also need the I<Win32 DBI patch kit> as supplied by Jeff Urlwin,
  538. which you can locate by reading the previous question's answer.
  539.  
  540. To get back to the question, theoretically, yes, you can access Microsoft 
  541. Access and SQL-Server databases from DBI I<via> ODBC!
  542.  
  543. =head2 3.4 Is the a DBD for <I<insert favourite database here>>?
  544.  
  545. Is is listed on the DBI drivers page?
  546.  
  547.     http://www.hermetica.com/technologia/perl/DBI/DBD
  548.  
  549. If not, no. A complete absence of a given database driver from that
  550. page means that no-one has announced any intention to work on it.
  551.  
  552. A corollary of the above statement implies that if you see an announcement
  553. for a driver I<not> on the above page, there's a good chance it's not
  554. actually a I<DBI> driver, and may not conform to the specifications. Therefore,
  555. questions concerning problems with that code should I<not> really be addressed
  556. to the DBI Mailing Lists.
  557.  
  558. =head2 3.5 What's DBM? And why should I use DBI instead?
  559.  
  560. Extracted from ``I<DBI - The Database Interface for Perl 5>'':
  561.  
  562.     ``UNIX was originally blessed with simple file-based ``databases'', namely
  563.     the dbm system. dbm lets you store data in files, and retrieve
  564.     that data quickly. However, it also has serious drawbacks.
  565.  
  566.         File Locking
  567.  
  568.         The dbm systems did not allow particularly robust file locking
  569.         capabilities, nor any capability for correcting problems arising through
  570.         simultaneous writes [ to the database ].
  571.  
  572.         Arbitrary Data Structures
  573.  
  574.         The dbm systems only allows a single fixed data structure:
  575.         key-value pairs. That value could be a complex object, such as a
  576.         [ C ] struct, but the key had to be unique. This was a large
  577.         limitation on the usefulness of dbm systems.
  578.  
  579.     However, dbm systems still provide a useful function for users with
  580.     simple datasets and limited resources, since they are fast, robust and 
  581.     extremely well-tested. Perl modules to access dbm systems have now
  582.     been integrated into the core Perl distribution via the
  583.     AnyDBM_File module.''
  584.  
  585. To sum up, DBM is a perfectly satisfactory solution for essentially read-only
  586. databases, or small and simple datasets with a single user. However,
  587. for more powerful and scaleable datasets, not to mention robust
  588. transactional locking, users are recommended to use I<DBI>.
  589.  
  590. =head2 3.6 When will mSQL-2 be supported?
  591.  
  592. As of I<DBD::mSQL-0.61>, there has been support for I<mSQL-2>.
  593. However, there is no real support for any of the new methods added to the
  594. core mSQL library regarding index support yet. These are forthcoming
  595. and will be accessible I<via> C<func()> methods private to I<DBD::mSQL>.
  596. You can read more about these private methods in the I<DBD::mSQL> POD
  597. that can be found by typing:
  598.  
  599.     perldoc DBD::mSQL
  600.  
  601. provided you have I<DBD::mSQL> correctly installed.
  602.  
  603. =head2 3.7 What database do you recommend me using?
  604.  
  605. This is a particularly thorny area in which an objective answer is difficult
  606. to come by, since each dataset, proposed usage and system configuration
  607. differs from person to person.
  608.  
  609. From the current author's point of view, if the dataset is relatively
  610. small, being tables of less than 1 million rows, and less than 1000 tables
  611. in a given database, then I<mSQL> is a perfectly acceptable solution
  612. to your problem. This database is extremely cheap, is wonderfully robust
  613. and has excellent support. More information is available on the Hughes
  614. Technology WWW site at:
  615.  
  616.     http://www.hughes.com.au
  617.  
  618. If the dataset is larger than 1 million row tables or 1000 tables, or if you
  619. have either more money, or larger machines, I would recommend the I<Oracle RDBMS>.
  620. Oracle's WWW site is an excellent source of more information.
  621.  
  622.     http://www.oracle.com
  623.  
  624. I<Informix> is another high-end RDBMS that is worth considering. There are
  625. several differences between Oracle and Informix which are too complex for
  626. this document to detail. Information on Informix can be found on their
  627. WWW site at:
  628.  
  629.     http://www.informix.com
  630.  
  631. In the case of WWW fronted applications, I<mSQL> may be a better option
  632. due to slow connection times between a CGI script and the Oracle RDBMS and
  633. also the amount of resource each Oracle connection will consume. I<mSQL>
  634. is lighter resource-wise and faster.
  635.  
  636. These views are not necessarily representative of anyone else's opinions,
  637. and do not reflect any corporate sponsorship or views. They are provided
  638. I<as-is>.
  639.  
  640. =head2 3.8 Is <I<insert feature here>> supported in DBI?
  641.  
  642. Given that we're making the assumption that the feature you have requested
  643. is a non-standard database-specific feature, then the answer will be I<no>.
  644.  
  645. DBI reflects a I<generic> API that will work for most databases, and has
  646. no database-specific functionality defined.
  647.  
  648. However, driver authors may, if they so desire, include hooks to database-specific
  649. functionality through the C<func()> method defined in the DBI API.
  650. Script developers should note that use of functionality provided I<via>
  651. the C<func()> methods is unlikely to be portable across databases.
  652.  
  653. =head1 Programming Questions
  654.  
  655. =head2 4.1 Is DBI any use for CGI programming?
  656.  
  657. In a word, yes! DBI is hugely useful for CGI programming! In fact, I would
  658. tentatively say that CGI programming is one of two top uses for DBI.
  659.  
  660. DBI confers the ability to CGI programmers to power WWW-fronted databases
  661. to their users, which provides users with vast quantities of ordered
  662. data to play with. DBI also provides the possibility that, if a site is
  663. receiving far too much traffic than their database server can cope with, they
  664. can upgrade the database server behind the scenes with no alterations to
  665. the CGI scripts.
  666.  
  667. =head2 4.2 How do I get faster connection times with DBD::Oracle and CGI?
  668.  
  669.     Contributed by John D. Groenveld
  670.  
  671. The Apache C<httpd> maintains a pool of C<httpd> children to service client 
  672. requests.
  673.  
  674. Using the Apache I<mod_perl> module by I<Doug MacEachern>, the perl 
  675. interpreter is embedded with the C<httpd> children. The CGI, DBI, and your 
  676. other favorite modules can be loaded at the startup of each child. These 
  677. modules will not be reloaded unless changed on disk.
  678.  
  679. For more information on Apache, see the Apache Project's WWW site:
  680.  
  681.     http://www.apache.org
  682.  
  683. The I<mod_perl> module can be downloaded from CPAN I<via>:
  684.  
  685.     http://www.perl.com/cgi-bin/cpan_mod?module=mod_perl
  686.  
  687. =head2 4.3 How do I get persistent connections with DBI and CGI?
  688.  
  689.     Contributed by John D. Groenveld
  690.  
  691. Using Edmund Mergl's I<Apache::DBI> module, database logins are stored in a 
  692. hash with each of these C<httpd> child. If your application is based on a 
  693. single database user, this connection can be started with each child. 
  694. Currently, database connections cannot be shared between C<httpd> children.
  695.  
  696. I<Apache::DBI> can be downloaded from CPAN I<via>:
  697.  
  698.     http://www.perl.com/cgi-bin/cpan_mod?module=Apache::DBI
  699.  
  700. =head2 4.4 ``My perl script runs from the command line, but fails under the C<httpd>!'' Why?
  701.  
  702. Basically, a good chance this is occurring is due to the fact that the user
  703. that you ran it from the command line as has a correctly configured set of
  704. environment variables, in the case of I<DBD::Oracle>, variables like
  705. C<$ORACLE_HOME>, C<$ORACLE_SID> or C<TWO_TASK>.
  706.  
  707. The C<httpd> process usually runs under the user id of C<nobody>,
  708. which implies there is no configured environment. Any scripts attempting to
  709. execute in this situation will correctly fail.
  710.  
  711. To solve this problem, set the environment for your database in a C<BEGIN { }>
  712. block at the top of your script. This will generally solve the problem.
  713.  
  714. Similarly, you should check your C<httpd> error logfile for any clues, as
  715. well as the very valuable ``Idiot's Guide To Solving Perl / CGI Problems''
  716. and ``Perl CGI Programming FAQ'' for further information. It is
  717. unlikely the problem is DBI-related.
  718.  
  719. The ``Idiot's Guide To Solving Perl / CGI Problems'' can be located at:
  720.  
  721.     http://www.perl.com/perl/faq/index.html
  722.  
  723. as can the ``Perl CGI Programming FAQ''. Read I<BOTH> these documents 
  724. carefully! They will probably save you many hours of work.
  725.  
  726. =head2 5.1 Can I do multi-threading with DBI?
  727.  
  728. As of the current date of this FAQ ( I<see top of page> ), no. perl
  729. does not support multi-threading. However, multi-threading is expected to
  730. become part of the perl core distribution as of version 5.005, which implies
  731. that DBI may support multi-threading fairly soon afterwards.
  732.  
  733. For some OCI example code for Oracle that has multi-threaded C<SELECT>
  734. statements, see:
  735.  
  736.     http://www.hermetica.com/technologia/oracle/oci/orathreads.tar.gz
  737.  
  738. =head2 5.2 How do I handle BLOB data with DBI?
  739.  
  740. To be written.
  741.  
  742. =head2 5.3 How can I invoke stored procedures with DBI?
  743.  
  744. There is currently no standard way to call stored procedures with DBI.
  745. However, if the database lets you use SQL to call stored procedures
  746. then the DBI and DBD driver probably will to.
  747.  
  748. For example, assuming that you have created a stored procedure within
  749. an Oracle database, you can use C<$dbh>->C<do()> to immediately execute
  750. the procedure:
  751.  
  752.     $dbh->do( "BEGIN someProcedure END;" );    # Oracle specific
  753.  
  754. =head2 5.4 How can I get return values from stored procedures with DBI?
  755.  
  756.     Note: This is Oracle specific. Contributed by Jeff Urlwin
  757.  
  758.     $sth = $dbh->prepare( "BEGIN foo(:1, :2, :3); END;" )  # Oracle specific
  759.                || die $sth->errstr;
  760.     $sth->bind_param(1, $a) || die $sth->errstr;
  761.     $sth->bind_param_inout(2, \$path, 2000)    || die $sth->errstr;
  762.     $sth->bind_param_inout(3, \$success, 2000) || die $sth->errstr;
  763.     $sth->execute || die $sth->errstr;
  764.  
  765. Note the error checking, it may seem like extra work but it'll probably save
  766. you hours in the long run. See $sth->{RaiseError} and $sth->{printError}
  767. in the DBI docs for easier ways to get the same effect.
  768.  
  769. =head2 5.5 How can I create or drop a database with DBI?
  770.  
  771. Database creation and deletion are concepts that are too abstract
  772. to be adequately supported by DBI. For example, Oracle does not support the
  773. concept of dropping a database at all! Also, in Oracle, the database
  774. I<server> essentially I<is> the database, whereas in mSQL, the
  775. server process runs happily without any databases created in it. The
  776. problem is too disparate to attack easily.
  777.  
  778. Some drivers, therefore, support database creation and deletion through
  779. the private C<func()> methods. You should check the documentation for
  780. the drivers you are using to see if they support this mechanism.
  781.  
  782. =head2 5.6 How can I C<commit> or C<rollback> a statement with DBI?
  783.  
  784. To be written. See the C<commit> or C<rollback> methods in the DBI docs.
  785.  
  786. =head2 5.7 How are C<NULL> values handled by DBI?
  787.  
  788. C<NULL> values in DBI are specified to be treated as the value C<undef>.
  789. C<NULL>s can be inserted into databases as C<NULL>, for example:
  790.  
  791.     $rv = $dbh->do( "INSERT INTO table VALUES( NULL )" );
  792.  
  793. but when queried back, the C<NULL>s should be tested against C<undef>.
  794. This is standard across all drivers.
  795.  
  796. =head2 5.8 What are these C<func()> methods all about?
  797.  
  798. The C<func()> method is defined within DBI as being an entry point
  799. for database-specific functionality, I<eg>, the ability to create or
  800. drop databases. Invoking these driver-specific methods is simple, for example,
  801. to invoke a C<createDatabase> method that has one argument, we would
  802. write:
  803.  
  804.     $rv = $dbh->func( 'argument', 'createDatabase' );
  805.  
  806. Software developers should note that the C<func()> methods are
  807. non-portable between databases.
  808.  
  809. =head1 Support and Training
  810.  
  811. The Perl5 Database Interface is I<FREE> software. IT COMES WITHOUT WARRANTY
  812. OF ANY KIND. See the DBI README and DBI documentation for more details.
  813.  
  814. However, some organizations are providing either technical support or
  815. training programs on DBI. The present author has no knowledge as
  816. to the quality of these services. The links are included for reference
  817. purposes only.
  818.  
  819. =head2 Commercial Support
  820.  
  821. =over 4
  822.  
  823. =item The Perl Clinic
  824.  
  825. The Perl Clinic can arrange commercial support contracts for I<Perl>, I<DBI>,
  826. I<DBD::Oracle> and I<Oraperl>. Support is provided by the company with whom
  827. Tim Bunce, author of DBI and DBD::Oracle, works. For more information
  828. on their services, please see:
  829.  
  830.     http://www.perl.co.uk/tpc
  831.  
  832. for more details.
  833.  
  834. =back
  835.  
  836. =head2 Training
  837.  
  838. No training programs are known at this time.
  839.  
  840. =head1 Other References
  841.  
  842. In this section, we present some miscellaneous WWW links that may be of
  843. some interest to DBI users. These are not verified and may result in
  844. unknown sites or missing documents.
  845.  
  846.     http://www-ccs.cs.umass.edu/db.html
  847.     http://www.odmg.org/odmg93/updates_dbarry.html
  848.     http://www.jcc.com/sql_stnd.html
  849.  
  850. =head1 AUTHOR
  851.  
  852. Alligator Descartes <I<descarte@hermetica.com>>
  853.  
  854. =head1 COPYRIGHT
  855.  
  856. This document is Copyright (c)1994-1997 Alligator Descartes, with portions
  857. Copyright (c)1994-1997 their original authors. This module is released under
  858. the 'Artistic' license which you can find in the perl distribution.
  859.  
  860. This document is Copyright (c)1997 Alligator Descartes. All rights reserved.
  861. Permission to distribute this document, in full or in part, via email,
  862. Usenet, ftp archives or http is granted providing that no charges are involved,
  863. reasonable attempt is made to use the most current version and all credits
  864. and copyright notices are retained ( the I<AUTHOR> and I<COPYRIGHT> sections ).
  865. Requests for other distribution rights, including incorporation into 
  866. commercial products, such as books, magazine articles or CD-ROMs should be
  867. made to Alligator Descartes <I<descarte@hermetica.com>>.
  868.  
  869. =for html
  870. <!-- Footer -->
  871. <P>
  872. <HR>
  873. <CENTER>
  874. <FONT SIZE="-1">
  875. <I>
  876. <B>© 1995-97 Hermetica</B><BR>
  877. <A HREF="/descarte/index.html">Alligator Descartes - Hermetica</A>
  878. </I>
  879. </FONT>
  880. </CENTER>
  881. </BODY>
  882. </HTML>
  883.