1 <!-- -*- DocBook -*- -->
4 <title>Database Back-ends</title>
9 <title>Libraries</title>
10 <para>The MySQL back-end needs access to the MySQL C
11 client library (<filename>libmysqlclient.so</filename>).
12 The location of this library is specified via
13 <symbol>*mysql-so-load-path*</symbol>, which defaults
14 to <filename>/usr/lib/libmysqlclient.so</filename>.
15 Additional flags to <application>ld</application> needed for
16 linking are specified via
17 <symbol>*mysql-so-libraries*</symbol>,
18 which defaults to <symbol>("-lc")</symbol>.</para>
21 <title>Initialization</title>
23 <programlisting>(mk:load-system :clsql-mysql)</programlisting>
24 to load the MySQL back-end. The database type for the MySQL
25 back-end is <symbol>:mysql</symbol>.</para>
28 <title>Connection Specification</title>
30 <title>Syntax of connection-spec</title>
31 <synopsis>(<replaceable>host</replaceable> <replaceable>db</replaceable> <replaceable>user</replaceable> <replaceable>password</replaceable>)</synopsis>
34 <title>Description of connection-spec</title>
37 <term><parameter>host</parameter></term>
39 <para>String representing the hostname or IP address
40 the MySQL server resides on, or <symbol>nil</symbol>
41 to indicate the localhost.</para>
45 <term><parameter>db</parameter></term>
47 <para>String representing the name of the database on
48 the server to connect to.</para>
52 <term><parameter>user</parameter></term>
54 <para>String representing the user name to use for
55 authentication, or <symbol>nil</symbol> to use the
56 current Unix user ID.</para>
60 <term><parameter>password</parameter></term>
62 <para>String representing the unencrypted password to
63 use for authentication, or <symbol>nil</symbol> if
64 the authentication record has an empty password
76 <title>Libraries</title>
77 <para>The AODBC back-end requires access to the ODBC interface
81 <title>Initialization</title>
83 <programlisting>(mk:load-system :clsql-aodbc)</programlisting>
84 to load the MySQL back-end. The database type for the AODBC
85 back-end is <symbol>:aodbc</symbol>.</para>
88 <title>Connection Specification</title>
90 <title>Syntax of connection-spec</title>
91 <synopsis>(<replaceable>dsn</replaceable> <replaceable>user</replaceable> <replaceable>password</replaceable>)</synopsis>
94 <title>Description of connection-spec</title>
97 <term><parameter>dsn</parameter></term>
99 <para>String representing the ODBC data source name.</para>
103 <term><parameter>user</parameter></term>
105 <para>String representing the user name to use for
106 authentication.</para>
110 <term><parameter>password</parameter></term>
112 <para>String representing the unencrypted password to
113 use for authentication.</para>
122 <title>PostgreSQL</title>
124 <title>Libraries</title>
125 <para>The PostgreSQL back-end needs access to the PostgreSQL C
126 client library (<filename>libpq.so</filename>). The
127 location of this library is specified via
128 <symbol>*postgresql-so-load-path*</symbol>, which defaults
129 to <filename>/usr/lib/libpq.so</filename>. Additional flags
130 to <application>ld</application> needed for linking are
131 specified via <symbol>*postgresql-so-libraries*</symbol>,
132 which defaults to <symbol>("-lcrypt" "-lc")</symbol>.</para>
135 <title>Initialization</title>
137 <programlisting>(mk:load-system :clsql-postgresql)</programlisting>
138 to load the PostgreSQL back-end. The database type for the
139 PostgreSQL back-end is <symbol>:postgresql</symbol>.</para>
142 <title>Connection Specification</title>
144 <title>Syntax of connection-spec</title>
145 <synopsis>(<replaceable>host</replaceable> <replaceable>db</replaceable> <replaceable>user</replaceable> <replaceable>password</replaceable> &optional <replaceable>port</replaceable> <replaceable>options</replaceable> <replaceable>tty</replaceable>)</synopsis>
148 <title>Description of connection-spec</title>
149 <para>For every parameter in the connection-spec,
150 <symbol>nil</symbol> indicates that the PostgreSQL default
151 environment variables (see PostgreSQL documentation) will
152 be used, or if those are unset, the compiled-in defaults
153 of the C client library are used.</para>
156 <term><parameter>host</parameter></term>
158 <para>String representing the hostname or IP address
159 the PostgreSQL server resides on. Use the empty
160 string to indicate a connection to localhost via
161 Unix-Domain sockets instead of TCP/IP.</para>
165 <term><parameter>db</parameter></term>
167 <para>String representing the name of the database on
168 the server to connect to.</para>
172 <term><parameter>user</parameter></term>
174 <para>String representing the user name to use for
175 authentication.</para>
179 <term><parameter>password</parameter></term>
181 <para>String representing the unencrypted password to
182 use for authentication.</para>
186 <term><parameter>port</parameter></term>
188 <para>String representing the port to use for
189 communication with the PostgreSQL server.</para>
193 <term><parameter>options</parameter></term>
195 <para>String representing further runtime options for
196 the PostgreSQL server.</para>
200 <term><parameter>tty</parameter></term>
202 <para>String representing the tty or file to use for
203 debugging messages from the PostgreSQL server.</para>
212 <title>PostgreSQL Socket</title>
214 <title>Libraries</title>
215 <para>The PostgreSQL Socket back-end needs
216 <emphasis>no</emphasis> access to the PostgreSQL C
217 client library, since it communicates directly with the
218 PostgreSQL server using the published frontend/backend
219 protocol, version 2.0. This eases installation and makes it
220 possible to dump CMU CL images containing CLSQL and this
221 backend, contrary to backends which require FFI code.</para>
224 <title>Initialization</title>
226 <programlisting>(mk:load-system :clsql-postgresql-socket)</programlisting>
227 to load the PostgreSQL Socket back-end. The database type for the
228 PostgreSQL Socket back-end is
229 <symbol>:postgresql-socket</symbol>.</para>
232 <title>Connection Specification</title>
234 <title>Syntax of connection-spec</title>
235 <synopsis>(<replaceable>host</replaceable> <replaceable>db</replaceable> <replaceable>user</replaceable> <replaceable>password</replaceable> &optional <replaceable>port</replaceable> <replaceable>options</replaceable> <replaceable>tty</replaceable>)</synopsis>
238 <title>Description of connection-spec</title>
241 <term><parameter>host</parameter></term>
243 <para>If this is a string, it represents the hostname or
244 IP address the PostgreSQL server resides on. In
245 this case communication with the server proceeds via
246 a TCP connection to the given host and port.</para>
248 If this is a pathname, then it is assumed to name the
249 directory that contains the server's Unix-Domain
250 sockets. The full name to the socket is then
251 constructed from this and the port number passed,
252 and communication will proceed via a connection to
253 this unix-domain socket.</para>
257 <term><parameter>db</parameter></term>
259 <para>String representing the name of the database on
260 the server to connect to.</para>
264 <term><parameter>user</parameter></term>
266 <para>String representing the user name to use for
267 authentication.</para>
271 <term><parameter>password</parameter></term>
273 <para>String representing the unencrypted password to
274 use for authentication. This can be the empty
275 string if no password is required for
276 authentication.</para>
280 <term><parameter>port</parameter></term>
282 <para>Integer representing the port to use for
283 communication with the PostgreSQL server. This
284 defaults to 5432.</para>
288 <term><parameter>options</parameter></term>
290 <para>String representing further runtime options for
291 the PostgreSQL server.</para>
295 <term><parameter>tty</parameter></term>
297 <para>String representing the tty or file to use for
298 debugging messages from the PostgreSQL server.</para>