faq.html

来自「perl教程」· HTML 代码 · 共 1,069 行 · 第 1/4 页

HTML
1,069 行
字号
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>DBI::FAQ -- The Frequently Asked Questions for the Perl5 Database Interface</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>

<script>writelinks('__top__',2);</script>
<h1><a>DBI::FAQ -- The Frequently Asked Questions for the Perl5 Database Interface</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#version">VERSION</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#basic_information___information_sources">Basic Information &amp; Information Sources</a></li>
	<ul>

		<li><a href="#1_1_what_is_dbi__dbperl__oraperl_and__perl">1.1 What is DBI, DBperl, Oraperl and *perl?</a></li>
		<li><a href="#1_2__where_can_i_get_it_from">1.2. Where can I get it from?</a></li>
		<li><a href="#1_3__where_can_i_get_more_information">1.3. Where can I get more information?</a></li>
	</ul>

	<li><a href="#compilation_problems">Compilation Problems</a></li>
	<ul>

		<li><a href="#2_1__compilation_problems_or_it_fails_the_test_">2.1. Compilation problems or &quot;It fails the test!&quot;</a></li>
	</ul>

	<li><a href="#platform_and_driver_issues">Platform and Driver Issues</a></li>
	<ul>

		<li><a href="#3_1_what_s_the_difference_between_odbc_and_dbi">3.1 What's the difference between ODBC and DBI?</a></li>
		<li><a href="#3_2_what_s_the_difference_between_win32__odbc_and_dbd__odbc">3.2 What's the difference between Win32::ODBC and DBD::ODBC?</a></li>
		<li><a href="#3_3_is_dbi_supported_under_windows_95___nt_platforms">3.3 Is DBI supported under Windows 95 / NT platforms?</a></li>
		<li><a href="#3_4_can_i_access_microsoft_access_or_sqlserver_databases_with_dbi">3.4 Can I access Microsoft Access or SQL-Server databases with DBI?</a></li>
		<li><a href="#3_5_is_the_a_dbd_for__insert_favourite_database_here_">3.5 Is the a DBD for &lt;<em>insert favourite database here</em>&gt;?</a></li>
		<li><a href="#3_6_what_s_dbm_and_why_should_i_use_dbi_instead">3.6 What's DBM? And why should I use DBI instead?</a></li>
		<li><a href="#3_7_what_database_do_you_recommend_me_using">3.7 What database do you recommend me using?</a></li>
		<li><a href="#3_8_is__insert_feature_here__supported_in_dbi">3.8 Is &lt;<em>insert feature here</em>&gt; supported in DBI?</a></li>
	</ul>

	<li><a href="#programming_questions">Programming Questions</a></li>
	<ul>

		<li><a href="#4_1_is_dbi_any_use_for_cgi_programming">4.1 Is DBI any use for CGI programming?</a></li>
		<li><a href="#4_2_how_do_i_get_faster_connection_times_with_dbd__oracle_and_cgi">4.2 How do I get faster connection times with DBD::Oracle and CGI?</a></li>
		<li><a href="#4_3_how_do_i_get_persistent_connections_with_dbi_and_cgi">4.3 How do I get persistent connections with DBI and CGI?</a></li>
		<li><a href="#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">4.4 ``When I run a perl script from the command line, it works, but, when I run it under the <code>httpd</code>, it fails!'' Why?</a></li>
		<li><a href="#4_5_how_do_i_get_the_number_of_rows_returned_from_a_select_statement">4.5 How do I get the number of rows returned from a <code>SELECT</code> statement?</a></li>
	</ul>

	<li><a href="#miscellaneous_questions">Miscellaneous Questions</a></li>
	<ul>

		<li><a href="#5_1_can_i_do_multithreading_with_dbi">5.1 Can I do multi-threading with DBI?</a></li>
		<li><a href="#5_2_how_do_i_handle_blob_data_with_dbi">5.2 How do I handle BLOB data with DBI?</a></li>
		<li><a href="#5_4_how_can_i_get_return_values_from_stored_procedures_with_dbi">5.4 How can I get return values from stored procedures with DBI?</a></li>
		<li><a href="#5_5_how_can_i_create_or_drop_a_database_with_dbi">5.5 How can I create or drop a database with DBI?</a></li>
		<li><a href="#5_6_how_can_i_commit_or_rollback_a_statement_with_dbi">5.6 How can I <code>commit</code> or <code>rollback</code> a statement with DBI?</a></li>
		<li><a href="#5_7_how_are_null_values_handled_by_dbi">5.7 How are <code>NULL</code> values handled by DBI?</a></li>
		<li><a href="#5_8_what_are_these_func___methods_all_about">5.8 What are these <code>func()</code> methods all about?</a></li>
		<li><a href="#5_9_is_dbi_year_2000_compliant">5.9 Is DBI Year 2000 Compliant?</a></li>
	</ul>

	<li><a href="#support_and_training">Support and Training</a></li>
	<ul>

		<li><a href="#commercial_support">Commercial Support</a></li>
		<li><a href="#training">Training</a></li>
	</ul>

	<li><a href="#other_references">Other References</a></li>
	<li><a href="#author">AUTHOR</a></li>
	<li><a href="#copyright">COPYRIGHT</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>DBI::FAQ -- The Frequently Asked Questions for the Perl5 Database Interface</p>
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#3a15ff" ALINK="#ff0000" VLINK="#ff282d">
<!--#include virtual="/technology/perl/DBI/templatetop.html" -->
<CENTER>
<FONT SIZE="+2">
DBI Frequently Asked Questions v.0.38
</FONT>
<BR>
<FONT SIZE="-1">
<I>Last updated: February 8th, 2000</I>
</FONT>
</CENTER>
<P><p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
    <a href="../../lib/Pod/perldoc.html">perldoc</a> DBI::FAQ</pre>
<p>
</p>
<hr />
<h1><a name="version">VERSION</a></h1>
<p>This document is currently at version <em>0.38</em>, as of <em>February 8th, 2000</em>.</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This document serves to answer the most frequently asked questions on both
the DBI Mailing Lists and personally to members of the DBI development team.</p>
<p>
</p>
<hr />
<h1><a name="basic_information___information_sources">Basic Information &amp; Information Sources</a></h1>
<p>
</p>
<h2><a name="1_1_what_is_dbi__dbperl__oraperl_and__perl">1.1 What is DBI, DBperl, Oraperl and *perl?</a></h2>
<p>To quote Tim Bunce, the architect and author of DBI:</p>
<pre>
    ``DBI is a database access Application Programming Interface (API)
      for the Perl Language. The DBI API Specification defines a set
      of functions, variables and conventions that provide a consistent
      database interface independant of the actual database being used.''</pre>
<p>In simple language, the DBI interface allows users to access multiple database
types transparently. So, if you connecting to an Oracle, Informix, mSQL, Sybase
or whatever database, you don't need to know the underlying mechanics of the
3GL layer. The API defined by DBI will work on <em>all</em> these database types.</p>
<p>A similar benefit is gained by the ability to connect to two <em>different</em>
databases of different vendor within the one perl script, <em>ie</em>, I want
to read data from an Oracle database and insert it back into an Informix
database all within one program. The DBI layer allows you to do this simply
and powerfully.</p>
Here's a diagram that demonstrates the principle:
<P>
<CENTER>
<IMG SRC="img/dbiarch.gif" WIDTH=451 HEIGHT=321 ALT="[ DBI Architecture ]">
</CENTER>
<P><p><em>DBperl</em> is the old name for the interface specification. It's usually
now used to denote perl<em>4</em> modules on database interfacing, such as,
<em>oraperl</em>, <em>isqlperl</em>, <em>ingperl</em> and so on. These interfaces
didn't have a standard API and are generally <em>not</em> supported.</p>
<p>Here's a list of DBperl modules, their corresponding DBI counterparts and
support information. <em>Please note</em>, the author's listed here generally
<em>do not</em> maintain the DBI module for the same database. These email
addresses are unverified and should only be used for queries concerning the
perl4 modules listed below. DBI driver queries should be directed to the
<em>dbi-users</em> mailing list.</p>
<pre>
    Module Name Database Required   Author          DBI
    ----------- -----------------   ------          ---
    Sybperl     Sybase              Michael Peppler DBD::Sybase
                                    &lt;mpeppler@itf.ch&gt;
    Oraperl     Oracle 6 &amp; 7        Kevin Stock     DBD::Oracle
                                    &lt;dbi-users@perl.org&gt;
    Ingperl     Ingres              Tim Bunce &amp;     DBD::Ingres
                                    Ted Lemon
                                    &lt;dbi-users@perl.org&gt;
    Interperl   Interbase           Buzz Moschetti  DBD::Interbase
                                    &lt;buzz@bear.com&gt;
    Uniperl     Unify 5.0           Rick Wargo      None
                                    &lt;rickers@coe.drexel.edu&gt;
    Pgperl      Postgres            Igor Metz       DBD::Pg
                                    &lt;metz@iam.unibe.ch&gt;
    Btreeperl   NDBM                John Conover    SDBM?
                                    &lt;john@johncon.com&gt;
    Ctreeperl   C-Tree              John Conover    None
                                    &lt;john@johncon.com&gt;
    Cisamperl   Informix C-ISAM     Mathias Koerber None
                                    &lt;mathias@unicorn.swi.com.sg&gt;
    Duaperl     X.500 Directory     Eric Douglas    None
                User Agent</pre>
<p>However, some DBI modules have DBperl emulation layers, so, <em>DBD::Oracle</em>
comes with an Oraperl emulation layer, which allows you to run legacy oraperl
scripts without modification. The emulation layer translates the oraperl API
calls into DBI calls and executes them through the DBI switch.</p>
<p>Here's a table of emulation layer information:</p>
<pre>
    Module                  Emulation Layer     Status
    ------          ---------------     ------
    DBD::Oracle     Oraperl             Complete
    DBD::Informix   Isqlperl            Under development
    DBD::Ingres     Ingperl             Complete?
    DBD::Sybase     Sybperl             Working? ( Needs verification )
    DBD::mSQL       Msqlperl            Experimentally released with 
                                        DBD::mSQL-0.61</pre>
<p>The <em>Msqlperl</em> emulation is a special case. <em>Msqlperl</em> is a perl5 driver
for <em>mSQL</em> databases, but does not conform to the DBI Specification. It's
use is being deprecated in favour of <em>DBD::mSQL</em>. <em>Msqlperl</em> may be downloaded
from CPAN <em>via</em>:</p>
<pre>
    <a href="http://www.perl.com/cgi-bin/cpan_mod?module=Msqlperl">http://www.perl.com/cgi-bin/cpan_mod?module=Msqlperl</a></pre>
<p>
</p>
<h2><a name="1_2__where_can_i_get_it_from">1.2. Where can I get it from?</a></h2>
<p>The Comprehensive Perl Archive Network
resources should be used for retrieving up-to-date versions of the DBI
and drivers. CPAN may be accessed <em>via</em> Tom Christiansen's splendid 
<em>CPAN multiplexer</em> program located at:</p>
<pre>
    <a href="http://www.perl.com/CPAN/">http://www.perl.com/CPAN/</a></pre>
<p>For more specific version information and exact URLs of drivers, please see
the DBI drivers list and the DBI module pages which can be found on:</p>
<pre>
    <a href="http://dbi.perl.org/">http://dbi.perl.org/</a>
    <a href="http://www.symbolstone.org/technology/perl/DBI">http://www.symbolstone.org/technology/perl/DBI</a></pre>
<p>This list is automatically generated on a nightly basis from CPAN and should
be up-to-date.</p>
<p>
</p>
<h2><a name="1_3__where_can_i_get_more_information">1.3. Where can I get more information?</a></h2>
<p>There are a few information sources on DBI.</p>
<dl>
<dt><strong><a name="item__22programming_the_perl_dbi_22"><em>&quot;Programming the Perl DBI&quot;</em></a></strong>

<dd>
<p>&quot;Programming the Perl DBI&quot; is the <em>official</em> book on the DBI written by
Alligator Descartes and Tim Bunce and published by O'Reilly &amp; Associates.
The book was released on February 9th, 2000.</p>
</dd>
<dd>
<p>The table of contents is:</p>
</dd>
<dd>
<pre>
    Preface
    1. Introduction
        From Mainframes to Workstations
        Perl
        DBI in the Real World
        A Historical Interlude and Standing Stones
    2. Basic Non-DBI Databases
        Storage Managers and Layers
        Query Languages and Data Functions
        Standing Stones and the Sample Database
        Flat-File Databases
        Putting Complex Data into Flat Files
        Concurrent Database Access and Locking
        DBM Files and the Berkeley Database Manager
        The MLDBM Module
        Summary
    3. SQL and Relational Databases
        The Relational Database Methodology
        Datatypes and NULL Values
        Querying Data
        Modifying Data Within Tables
        Creating and Destroying Tables
    4. Programming with the DBI
        DBI Architecture
        Handles
        Data Source Names
        Connection and Disconnection
        Error Handling
        Utility Methods and Functions

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?