~ubuntu-branches/ubuntu/precise/libdbi-drivers/precise

« back to all changes in this revision

Viewing changes to drivers/mysql/dbd_mysql.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2008-08-02 09:00:11 UTC
  • mfrom: (3.1.6 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080802090011-j05v2349u2ptvg05
Tags: 0.8.2-1-4.1
* Non-maintainer upload with maintainer's approval.
* High urgency upload for RC bugfix.
* Pass --freetds-inc-dir to configure, to bypass the ridiculous upstream
  AC_FIND_FILE() checks for files that *aren't used during the build*;
  fixes a build failure with FreeTDS 0.82.  Closes: #493349.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE Book PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
 
2
<!-- $Id: dbd_mysql.sgml,v 1.3 2005/07/17 00:58:09 mhoenicka Exp $ -->
 
3
<book>
 
4
  <bookinfo>
 
5
    <title>mysql driver manual</title>
 
6
    <subtitle>A libdbi driver providing connectivity to MySQL databases using libmysqlclient.</subtitle>
 
7
  <author>
 
8
      <firstname>Mark</firstname>
 
9
      <surname>Tobenkin</surname>
 
10
      <affiliation>
 
11
        <address><email>mmt@users.sourceforge.net</email></address>
 
12
      </affiliation>
 
13
    </author>
 
14
    <revhistory>
 
15
      <revision>
 
16
        <revnumber>0.4</revnumber>
 
17
        <date>2005-07-15</date>
 
18
      </revision>
 
19
      <revision>
 
20
        <revnumber>0.3</revnumber>
 
21
        <date>2003-4-12</date>
 
22
      </revision>
 
23
      <revision>
 
24
        <revnumber>0.2</revnumber>
 
25
        <date>2003-2-4</date>
 
26
      </revision>
 
27
      <revision>
 
28
        <revnumber>0.1</revnumber>
 
29
        <date>2002-11-5</date>
 
30
      </revision>
 
31
    </revhistory>
 
32
  </bookinfo>
 
33
  <preface>
 
34
    <title>Preface</title>
 
35
    <para><ulink url="http://libdbi.sourceforge.net">libdbi</ulink> is a database abstraction layer written in C. It implements a framework that can utilize separate driver libraries for specific database servers. The <ulink url="http://libdbi-drivers.sourceforge.net">libdbi-drivers</ulink> project provides the drivers necessary to talk to the supported database servers.</para>
 
36
    <para>This manual provides information about the MySQL driver. The manual is intended for programmers who write applications linked against libdbi and who want their applications to work with the MySQL driver.</para>
 
37
    <para>Questions and comments about the MySQL driver should be sent to the <ulink url="mailto:libdbi-drivers-devel@lists.sourceforge.net">libdbi-drivers-devel</ulink> mailing list. Visit the <ulink url="http://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel">libdbi-drivers-devel list page</ulink> to subscribe and for further information. Questions and comments about the libdbi library should be sent to the appropriate libdbi mailing list.</para>
 
38
    <para>The MySQL driver is maintained by <ulink url="mailto:mmt@users.sourceforge.net">Mark Tobenkin</ulink>.</para>
 
39
  </preface>
 
40
  <chapter>
 
41
    <title>Introduction</title>
 
42
    <para><ulink url="http://www.mysql.org">MySQL</ulink>, as of the time of this document's writing, is one of the fastest growing database systems worldwide. With approximately 4 million installations, and 30,000 daily downloads, the server has found a niche in the website development community. Quick deployment and ease of use are among it's assets.</para>
 
43
  </chapter>
 
44
  <chapter>
 
45
    <title>Installation</title>
 
46
    <para>This chapter describes the prerequisites and the procedures to build and install the mysql driver from the sources.</para>
 
47
    <sect1>
 
48
      <title>Prerequisites</title>
 
49
      <para>The following packages have to be installed on your system:</para>
 
50
      <variablelist>
 
51
        <varlistentry>
 
52
          <term>libdbi</term>
 
53
          <listitem>
 
54
            <para>This library provides the framework of the database abstraction layer which can utilize the MySQL driver to perform database operations. The download page as well as the mailing lists with bug reports and patches are accessible at <ulink url="http://sourceforge.net/projects/libdbi">sourceforge.net/projects/libdbi</ulink>. The current version of the MySQL driver requires libdbi version 0.8.x.</para>
 
55
          </listitem>
 
56
        </varlistentry>
 
57
        <varlistentry>
 
58
          <term>libmysqlclient</term>
 
59
          <listitem>
 
60
            <para>This library implements the client API for MySQL programs. Find the most recent release at <ulink url="http://www.mysql.org">www.mysql.org</ulink>. The current version of the mysql driver was tested with MySQL version 4.1.10a, and it should work with other 4.x releases.</para>
 
61
          </listitem>
 
62
        </varlistentry>
 
63
      </variablelist>
 
64
    </sect1>
 
65
    <sect1>
 
66
      <title>Build and install the mysql driver</title>
 
67
      <para>First you have to unpack the libdbi-drivers archive in a suitable directory. Unpacking will create a new subdirectory <filename class="directory">libdbi-drivers-X.Y</filename> where "X.Y" denotes the version:</para>
 
68
      <screen><prompt>$ </prompt><userinput>tar -xzf libdbi-drivers-X.Y.tar.gz</userinput></screen>
 
69
      <para>The libdbi-drivers project consists of several drivers that use a common build system. Therefore you <emphasis>must</emphasis> tell configure explicitly that you want to build the mysql driver (you can list as many drivers as you want to build):</para>
 
70
      <screen><prompt>$ </prompt><userinput>cd libdbi-drivers</userinput></screen>
 
71
      <screen><prompt>$ </prompt><userinput>./configure --with-mysql</userinput></screen>
 
72
      <para>Run <command>./configure --help</command> to find out about additional options.</para>
 
73
      <para>Then build the driver with the command:</para>
 
74
      <screen><prompt>$ </prompt><userinput>make</userinput></screen>
 
75
      <note>
 
76
        <para>Please note that you may have to invoke <command>gmake</command>, the GNU version of make, on some systems.</para>
 
77
      </note>
 
78
      <para>Then install the driver with the command (you'll need root permissions to do this):</para>
 
79
      <screen><prompt>$ </prompt><userinput>make install</userinput></screen>
 
80
      <para>To test the operation of the newly installed driver, use the command:</para>
 
81
      <screen><prompt>$ </prompt><userinput>make check</userinput></screen>
 
82
      <para>This command creates and runs a test program that performs a few basic input and output tests. The program will ask for an administrator username and password. This user can be any user who has database creation priveleges. Be sure to provide the name of a database which does not already exist (avoid 'test' which is used on many systems).</para>
 
83
      <note>
 
84
        <para>If for some reason you need to re-create the autoconf/automake-related files, try running <command moreinfo="none">./autogen.sh</command>. I've found out that the current stable autoconf/automake/libtool versions (as found in FreeBSD 4.7 and Debian 3.0) do not cooperate well, so I found it necessary to run the older autoconf 2.13. If necessary, edit <filename moreinfo="none">autogen.sh</filename> so that it will catch the older autoconf version on your system.</para>
 
85
      </note>
 
86
    </sect1>
 
87
  </chapter>
 
88
  <chapter>
 
89
    <title>Driver options</title>
 
90
    <para>Your application has to initialize libdbi drivers by setting some driver options with the <function>dbi_conn_set_option()</function> and the <function>dbi_conn_set_option_numeric()</function> library functions. The mysql driver supports the following options:</para>
 
91
    <variablelist>
 
92
      <varlistentry>
 
93
        <term>host</term>
 
94
        <listitem>
 
95
          <para>The hostname or IP address of the MySQL database server. Use an empty string or "localhost" to connect to a MySQL server running on the local machine.</para>
 
96
        </listitem>
 
97
      </varlistentry>
 
98
      <varlistentry>
 
99
        <term>port (numeric)</term>
 
100
        <listitem>
 
101
          <para>The port used to remotely connect to the MySQL database server over TCP. Use "0" (zero) to accept the default socket.</para>
 
102
        </listitem>
 
103
      </varlistentry>
 
104
      <varlistentry>
 
105
        <term>username</term>
 
106
        <listitem>
 
107
          <para>The name of the user accessing the database.</para>
 
108
        </listitem>
 
109
      </varlistentry>
 
110
      <varlistentry>
 
111
        <term>password</term>
 
112
        <listitem>
 
113
          <para>The password of the user accessing the database.</para>
 
114
        </listitem>
 
115
      </varlistentry>
 
116
      <varlistentry>
 
117
        <term>dbname</term>
 
118
        <listitem>
 
119
          <para>The name of the database used for the initial connection. If your program must be able to connect to a fresh MySQL installation, use the system database <filename moreinfo="none">mysql</filename>.</para>
 
120
        </listitem>
 
121
      </varlistentry>
 
122
      <varlistentry>
 
123
        <term>encoding</term>
 
124
        <listitem>
 
125
          <para>The IANA name of a character encoding which is to be used as the connection encoding. Input and output data will be silently converted from and to this character encoding, respectively. The list of available character encodings depends on your local MySQL installation. If you set this option to "auto", the connection encoding will be the same as the default encoding of the database.</para>
 
126
        </listitem>
 
127
      </varlistentry>
 
128
      <varlistentry>
 
129
        <term>mysql_include_trailing_null (numeric)</term>
 
130
        <listitem>
 
131
          <para>This item will tell the driver whether or not to include trailing null values ('\0') at the end of binary strings. This applies to the types BLOB, MEDIUMBLOB, LARGEBLOB etc. A numeric value of 0 will tell the driver to leave off the NULL value. A value of 1 will tell the driver to include the trailing NULL character. </para>
 
132
        </listitem>
 
133
      </varlistentry>
 
134
      <varlistentry>
 
135
        <term>mysql_unix_socket</term>
 
136
        <listitem>
 
137
          <para>The filename of the Unix socket used to connect to a MySQL database server running on the local machine. Provide an empty string to use the default socket.</para>
 
138
        </listitem>
 
139
      </varlistentry>
 
140
      <varlistentry>
 
141
        <term>mysql_compression (numeric)</term>
 
142
        <listitem>
 
143
          <para>A value larger than zero causes the client/server communication to be compressed. Set this to zero to use no data compression.</para>
 
144
        </listitem>
 
145
      </varlistentry>
 
146
    </variablelist>
 
147
  </chapter>
 
148
  <chapter>
 
149
    <title>Peculiarities you should know about</title>
 
150
    <para>This chapter lists known peculiarities of the mysql driver. This includes MySQL features that differ from what you know from the other database servers supported by libdbi, and it includes features and misfeatures introduced by the mysql driver. It is the intention of the driver author to reduce the number of misfeatures in future releases if possible.</para>
 
151
    <sect1>
 
152
      <title>MySQL (mis)features</title>
 
153
      <itemizedlist>
 
154
        <listitem>
 
155
          <para>To allow for row seeking, results are loaded into memory. This is very inefficient and may provide a bottleneck for large applications.</para>
 
156
        </listitem>
 
157
        <listitem>
 
158
          <para>DATETIME, TIMESTAMP, DATE and TIME are all treated as the DBI type DATETIME. This is currently a string, but will change in later releases.</para>
 
159
        </listitem>
 
160
        <listitem>
 
161
          <para>The DECIMAL type is treated as a string, as it has arbitrary precision.</para>
 
162
        </listitem>
 
163
      </itemizedlist>
 
164
    </sect1>
 
165
  </chapter>
 
166
</book>