File: db2.html

package info (click to toggle)
sqlrelay 1%3A0.37.1-3.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 13,084 kB
  • ctags: 6,691
  • sloc: cpp: 48,136; python: 10,118; ansic: 9,673; java: 9,195; php: 8,839; perl: 8,827; sh: 8,554; ruby: 8,516; tcl: 5,039; makefile: 3,665
file content (504 lines) | stat: -rw-r--r-- 23,597 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
<html>

<head>
<title>SQL Relay - Getting Started With IBM DB2</title>
<link rel="stylesheet" href="../css/styles.css">
</head>

<body>

<span class="heading1">Getting Started With IBM DB2</span><br>

<ul>
<li><a href="#installation">Installation</a></li>
<ul>
<li><a href="#pdksh">Install pdksh</a></li>
<li><a href="#rpm">Install RPM</a></li>
<li><a href="#env">PATH Environment Variable</a></li>
<li><a href="#db2">DB2 Installation</a></li>
</ul>
<li><a href="#creating">Creating a Database</a></li>
<li><a href="#accessing">Accessing a Database</a></li>
<ul>
<li><a href="#accessinglocal">Accessing a Local Database</a></li>
<li><a href="#accessingremote">Accessing a Remote Database</a></li>
<li><a href="#usingdb2">Using the DB2 Client Program</a></li>
<li><a href="#usingdb2icc">Using the DB2 Information and Control Centers</a></li>
</ul>
<li><a href="#sqlrelay">Accessing a Database With SQL Relay</a></li>
</ul>

<a name="installation"></a>
<span class="heading1">Installation</span><br>

<p>I've sucessfully installed DB2 Enterprise Edition versions 7.2 and 8.1 on
Linux and DB2 Personal Edition version 8.2 on Linux.  I've never had access to
any other version of DB2 for Linux or any version of DB2 for other
platforms.</p>

<a name="pdksh"></a>
<span class="heading2">Install pdksh</span><br>

<p>If you're installing version 7.2, first and foremost, you need pdksh
(Public Domain Korn Shell).  If it did not come with your distribution, you'll
need to download and install it.</p>

<p>For RPM based distributions, look for pdksh at 
<a href="http://rpmfind.net">rpmfind</a> and install it using <i>rpm -i</i>.</p>

<p>For Debian Linux, on newer Debian releases, if you have configured 
<i>apt</i> as illustrated in 
<a href="http://www.debian.org/doc/manuals/apt-howto/index.en.html">the 
APT-HOWTO</a>, run <i>apt-get install pdksh</i>.  If your distribution came with
pdksh, you may be prompted to enter a CD.  If not, it will be downloaded from 
the internet.<p>

<p>For Slackware Linux, the pdksh package is available from 
<a href="ftp://ftp.slackware.com">ftp.slackware.com</a>.  You can install it 
using <i>installpkg</i>.</p>

<a name="rpm"></a>
<span class="heading2">Install RPM</span><br>

<p>On non-RPM based systems, you'll need to install RPM.</p>

<p>For Slackware Linux, the RPM package is available from 
<a href="ftp://ftp.slackware.com">ftp.slackware.com</a>.  You can install it 
using <i>installpkg</i>.  Once RPM is installed, log in as root and run
<i>rpm --initdb</i>.</p>

<p>On newer Debian releases, if you have configured <i>apt</i> as illustrated 
in <a href="http://www.debian.org/doc/manuals/apt-howto/index.en.html">the 
APT-HOWTO</a>, run <i>apt-get install rpm</i>.  If your distribution came with
RPM, you may be prompted to enter a CD.  If not, it will be downloaded from the
internet.  Once RPM is installed, log in as root and run <i>rpm --initdb</i>.

<p>On systems where the <i>rpm</i> command resides in /usr/bin,  you need to 
create a symbolic link between <i>/usr/bin/rpm</i> and <i>/bin/rpm</i> as 
follows.</p>

<blockquote>
<b>ln -s /usr/bin/rpm /bin/rpm</b>
</blockquote>

<a name="env"></a>
<span class="heading2">PATH Environment Variable</span><br>

<p>For versions 7.2 and 8.1, the DB2 installer tries to run some command line
programs that are found in /sbin and /usr/sbin.  Make sure that these
directories are in the root user's PATH.</p>

<a name="db2"></a>
<span class="heading2">DB2 Installation</span><br>

<p>Each version of DB2 has a slightly different installation procedure.
Follow the links below for the version of DB2 that you are installing.</p>

<p><a href="db2/72.html">Installing IBM DB2 Enterprise V7.2</a><br>
<a href="db2/81.html">Installing IBM DB2 Enterprise V8.1</a><br>
<a href="db2/82.html">Installing IBM DB2 Personal V8.2</a></p>

<a name="creating"></a>
<span class="heading2">Creating a Database</span><br>

<p>Now that you have created an instance, you must create a database within
the instance.  Log in as db2inst1 and run the following command to create a
database named <i>testdb</i>.</p>

<blockquote>
<b>db2 "create database testdb"</b>
</blockquote>

<p>Should you need to drop a database, the following command drops a database
named <i>testdb</i>.</p>

<blockquote>
<b>db2 "drop database testdb"</b>
</blockquote>

<a name="accessing"></a>
<span class="heading1">Accessing a Database</span><br>

<br><br>

<a name="accessinglocal"></a>
<span class="heading2">Accessing a Local Database</span><br>

<p>Accessing a local DB2 database using the db2 client tool is simple.  For 
example, to access a database called <i>testdb</i> in the <i>db2inst1</i> 
instance, owned by the <i>db2inst1</i> user on the local machine, log in as 
<i>db2inst1</i> and run the <i>db2</i> command.  Then use the CONNECT
command to connect to a particular database.</p>

<blockquote>
<PRE>
[db2inst1@localhost db2inst1]$ <b>db2</b>
c(c) Copyright IBM Corporation <FONT color=#ff00ff>1993</FONT>,<FONT color=#ff00ff>2001</FONT>
Command Line Processor for DB2 SDK <FONT color=#ff00ff>7.2</FONT>.<FONT color=#ff00ff>0</FONT>

You can issue database manager commands and SQL statements from the command 
prompt. For example:
    db2 =&gt; <FONT color=#6959cf>connect</FONT> <FONT color=#6959cf>to</FONT> sample
    db2 =&gt; bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside 
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

<b>db2 =&gt; <FONT color=#6959cf>connect</FONT> <FONT color=#6959cf>to</FONT> testdb</b>

   Database Connection Information

 Database server        = DB2/LINUX <FONT color=#ff00ff>7.2</FONT>.<FONT color=#ff00ff>0</FONT>
 SQL authorization ID   = DB2INST1
 Local database alias   = TESTDB

</PRE>
</blockquote>

<a name="accessingremote"></a>
<span class="heading2">Accessing a Remote Database</span><br>

<p>If you want to access a database on a remote machine, the process is more
complex.  DB2 or "DB2 Connect" must be installed on the local and remote 
machines and a DB2 or "DB2 Connect" instance must be created on the local 
machine.  "DB2 Connect" is a lightweight version of the DB2 database system
whose instances cannot support a local database, and can only provide 
connectivity to a remote instance.  In the instance on the local machine, use 
the CATALOG command to create aliases for the remote instance and 
database.  Once these aliases are created, you can use the database alias to
connect to the remote database.</p>

<p>Take the following scenario:</p>

<blockquote>
<table border="1">
<tr><td colspan="2"><b>local machine</b></td></tr>
<tr><td>Hostname</td><td><i>localhost</i></td></tr>
<tr><td>Instance</td><td><i>db2inst1</i></td></tr>
</table>
</blockquote>

<blockquote>
<table border="1">
<tr><td colspan="2"><b>remote machine</b></td></tr>
<tr><td>Hostname</td><td><i>remotehost</i></td></tr>
<tr><td>Instance</td><td><i>testinst<br>
<pre>
	owned by user testinst with password testpassword
	allows remote connections on port 50000
<pre>
</i></td></tr>
<tr><td>Database</td><td><i>testdb</i></td></tr>
</table>
</blockquote>

<p>On <i>localhost</i>, in the <i>db2inst1</i> instance, to create an instance
alias named <i>remoteinst</i> referring to <i>testinst</i> on 
<i>remotehost</i>, and a database alias named <i>remotedb</i> referring to 
<i>testdb</i>, follow this procedure.</p>

<blockquote>
log in as db2inst1 on localhost<br>
create the instance alias using the following commands:<br>
<blockquote><b>
db2 "catalog tcpip node <i>remoteinst</i> remote <i>remotehost</i> server
<i>50000</i>"<br>
db2 "terminate"<br>
</b></blockquote>
create the database alias using the following commands:<br>
<blockquote><b>
db2 "catalog database <i>testdb</i> as <i>remotedb</i> at node 
<i>remoteinst</i>"<br>
db2 "terminate"<br>
</b></blockquote>
</blockquote>

<p>Now that the aliases have been created, you can connect to the database alias
using the CONNECT comamnd.  Note that you must supply the user name and 
password.</p>

<blockquote>
<PRE>
[db2inst1@localhost db2inst1]$ <b>db2</b>
c(c) Copyright IBM Corporation <FONT color=#ff00ff>1993</FONT>,<FONT color=#ff00ff>2001</FONT>
Command Line Processor for DB2 SDK <FONT color=#ff00ff>7.2</FONT>.<FONT color=#ff00ff>0</FONT>

You can issue database manager commands and SQL statements from the command 
prompt. For example:
    db2 =&gt; <FONT color=#6959cf>connect</FONT> <FONT color=#6959cf>to</FONT> sample
    db2 =&gt; bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside 
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

<b>db2 =&gt; <FONT color=#6959cf>connect</FONT> <FONT color=#6959cf>to</FONT> remotedb <FONT color=#6959cf>user</FONT> testinst <FONT color=#6959cf>using</FONT> testpassword</b>

   Database Connection Information

 Database server        = DB2/LINUX <FONT color=#ff00ff>7.2</FONT>.<FONT color=#ff00ff>0</FONT>
 SQL authorization ID   = TESTINST
 Local database alias   = REMOTEDB

</PRE>
</blockquote>

<p>If you need to get a list of instance aliases, you can use the LIST NODE 
DIRECTORY command as follows.</p>

<blockquote>
<b>db2 "list node directory"</b>
</blockquote>

<p>To list the database aliases, you can use the LIST DATABASE DIRECTORY
command.  Note that this command lists local databases as well as remote
databases.</p>

<blockquote>
<b>db2 "list database directory"</b>
</blockquote>

<p>If you need to drop a database or instance alias, use the UNCATALOG command.
The following commands remove the <i>remotedb</i> database alias and the
<i>remoteinst</i> instance alias.</p>

<blockquote><b>
db2 "uncatalog database <i>remotedb</i>"<br>
db2 "uncatalog node <i>remoteinst</i>"<br>
db2 "terminate"
</b></blockquote>

<a name="usingdb2"></a>
<span class="heading1">Using the DB2 Client Program</span><br>

<p>When run with no arguments, the <i>db2</i> client program provides an 
interactive shell, prompting you to enter commands or an SQL queries.  Commands 
or queries must be entered on a single line and will run when the Enter or 
Return key is pressed.  To exit, type quit.</p>

<p>A sample <i>db2</i> session follows.</p>

<blockquote>
<PRE>
[db2inst1@localhost db2inst1]$ <b>db2</b>
c(c) Copyright IBM Corporation <FONT color=#ff00ff>1993</FONT>,<FONT color=#ff00ff>2001</FONT>
Command Line Processor for DB2 SDK <FONT color=#ff00ff>7.2</FONT>.<FONT color=#ff00ff>0</FONT>

You can issue database manager commands and SQL statements from the command 
prompt. For example:
    db2 =&gt; <FONT color=#6959cf>connect</FONT> <FONT color=#6959cf>to</FONT> sample
    db2 =&gt; bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside 
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

<b>db2 =&gt;</b> <FONT color=#6959cf>connect</FONT> <FONT color=#6959cf>to</FONT> testdb

   Database Connection Information

 Database server        = DB2/LINUX <FONT color=#ff00ff>7.2</FONT>.<FONT color=#ff00ff>0</FONT>
 SQL authorization ID   = DB2INST1
 Local database alias   = TESTDB

<b>db2 =&gt;</b> <B><FONT color=#a62828>create</FONT></B> <FONT color=#6959cf>table</FONT> testtable (col1 <B><FONT color=#288a51>char</FONT></B>(<FONT color=#ff00ff>40</FONT>), col2 int)
DB20000I  The SQL command completed successfully.
<b>db2 =&gt;</b> list tables

Table/View                      Schema          Type  Creation time
<FONT color=#0000ff>------------------------------- --------------- ----- --------------------------</FONT>
TESTTABLE                       DB2INST1        T     <FONT color=#ff00ff>2002-03-01-01</FONT>.<FONT color=#ff00ff>55</FONT>.<FONT color=#ff00ff>19</FONT>.<FONT color=#ff00ff>671629</FONT>

  <FONT color=#ff00ff>1</FONT> record(s) selected.

<b>db2 =&gt;</b> describe <FONT color=#6959cf>table</FONT> testtable show detail

Column                         Type                                                                                        Column     Partitioning key    Code
name                           schema                          Type name                       Length    Scale    Nulls    number     sequence            page     Default
<FONT color=#0000ff>------------------------------ ------------------------------- ------------------------------- --------- -------- -------- ---------- ------------------- -------- ----------------------------------------</FONT>
COL1                           SYSIBM                          <B><FONT color=#288a51>CHARACTER</FONT></B>                              <FONT color=#ff00ff>40</FONT>        <FONT color=#ff00ff>0</FONT> Yes               <FONT color=#ff00ff>0</FONT>                   <FONT color=#ff00ff>0</FONT>      <FONT color=#ff00ff>819</FONT>                                                                                                                                                                                                                                                               
COL2                           SYSIBM                          <B><FONT color=#288a51>INTEGER</FONT></B>                                 <FONT color=#ff00ff>4</FONT>        <FONT color=#ff00ff>0</FONT> Yes               <FONT color=#ff00ff>1</FONT>                   <FONT color=#ff00ff>0</FONT>        <FONT color=#ff00ff>0</FONT>                                                                                                                                                                                                                                                               

  <FONT color=#ff00ff>2</FONT> record(s) selected.

<b>db2 =&gt;</b> <B><FONT color=#a62828>insert</FONT></B> <FONT color=#6959cf>into</FONT> testtable <FONT color=#6959cf>values</FONT> (<FONT color=#ff00ff>'hello'</FONT>,<FONT color=#ff00ff>50</FONT>)
DB20000I  The SQL command completed successfully.
<b>db2 =&gt;</b> <B><FONT color=#a62828>insert</FONT></B> <FONT color=#6959cf>into</FONT> testtable <FONT color=#6959cf>values</FONT> (<FONT color=#ff00ff>'hi'</FONT>,<FONT color=#ff00ff>60</FONT>)
DB20000I  The SQL command completed successfully.
<b>db2 =&gt;</b> <B><FONT color=#a62828>insert</FONT></B> <FONT color=#6959cf>into</FONT> testtable <FONT color=#6959cf>values</FONT> (<FONT color=#ff00ff>'bye'</FONT>,<FONT color=#ff00ff>70</FONT>)
DB20000I  The SQL command completed successfully.
<b>db2 =&gt;</b> <B><FONT color=#a62828>select</FONT></B> * <FONT color=#6959cf>from</FONT> testtable

COL1                                     COL2       
<FONT color=#0000ff>---------------------------------------- -----------</FONT>
hello                                             <FONT color=#ff00ff>50</FONT>
hi                                                <FONT color=#ff00ff>60</FONT>
bye                                               <FONT color=#ff00ff>70</FONT>

  <FONT color=#ff00ff>3</FONT> record(s) selected.

<b>db2 =&gt;</b> <B><FONT color=#a62828>update</FONT></B> testtable <B><FONT color=#a62828>set</FONT></B> col2=<FONT color=#ff00ff>0</FONT> <FONT color=#6959cf>where</FONT> col1=<FONT color=#ff00ff>'hi'</FONT>
DB20000I  The SQL command completed successfully.
<b>db2 =&gt;</b> <B><FONT color=#a62828>select</FONT></B> * <FONT color=#6959cf>from</FONT> testtable

COL1                                     COL2       
<FONT color=#0000ff>---------------------------------------- -----------</FONT>
hello                                             <FONT color=#ff00ff>50</FONT>
hi                                                 <FONT color=#ff00ff>0</FONT>
bye                                               <FONT color=#ff00ff>70</FONT>

  <FONT color=#ff00ff>3</FONT> record(s) selected.

<b>db2 =&gt;</b> <B><FONT color=#a62828>delete</FONT></B> <FONT color=#6959cf>from</FONT> testtable <FONT color=#6959cf>where</FONT> col2=<FONT color=#ff00ff>50</FONT>
DB20000I  The SQL command completed successfully.
<b>db2 =&gt;</b> <B><FONT color=#a62828>select</FONT></B> * <FONT color=#6959cf>from</FONT> testtable

COL1                                     COL2       
<FONT color=#0000ff>---------------------------------------- -----------</FONT>
hi                                                 <FONT color=#ff00ff>0</FONT>
bye                                               <FONT color=#ff00ff>70</FONT>

  <FONT color=#ff00ff>2</FONT> record(s) selected.

<b>db2 =&gt;</b> <B><FONT color=#a62828>drop</FONT></B> <FONT color=#6959cf>table</FONT> testtable
DB20000I  The SQL command completed successfully.
<b>db2 =&gt;</b> quit
DB20000I  The QUIT command completed successfully.
</PRE>
</blockquote>

<a name="usingdb2icc"></a>
<span class="heading1">Using the DB2 Information and Control Centers</span><br>

<p>IBM DB2 comes with a set of user-friendly, Java-based GUI utilities for 
browsing and configuring database instances.</p>

<p>These utilities require the Java Runtime Enviroment version 1.1.8 
or higher.  For Linux, JRE's are available as RPM's or 
tarballs from <a href="http://www.blackdown.org">Blackdown</a>,
<a href="http://java.sun.com">Sun</a> and
<a href="http://www.ibm.com/java/jdk">IBM</a>.  Of course, IBM recommends that
you use their JRE.</p>

<p>To run the DB2 Information Center or Control Center, you have to log in as
a database instance or adminstrative server owner such as <i>db2as</i> or
<i>db2inst1</i>.</p>

<p>Make sure that the <i>jre</i> command is in the PATH environment variable 
for that user.  If it isn't, modify that user's .bashrc to include it.</p>

<p>If you are running a 2.4 (or higher) kernel, add the following line to the
user's .bashrc as well.</p>

<blockquote>
<b>export LD_ASSUME_KERNEL=2.2.5</b>
</blockquote>

<p>If you are running a kernel with Native Posix Threading Library support
(such as on Redhat 9) then you need to add this line instead:</p>

<blockquote>
<b>export LD_ASSUME_KERNEL=2.4.1</b>
</blockquote>

<p>This may be necessary on other systems too.  It is definitely necessary on
Redhat 9.</p>

<p>To run the Information Center or Control Center, you first have to run the
DB2 Java Server and give it a port number as follows.</p>

<blockquote>
<b>db2jstrt 6720</b>
</blockquote>

<p>Once it's running, you can run the DB2 Information Center or Control Center,
also supplying the port.</p>

<blockquote>
<b>db2ic 6720</b><br><br>
or<br><br>
<b>db2cc 6720</b>
</blockquote>

<p>Both utilities will ask for the username and password of an instance owner.  
Once you supply these credentials, you can browse and/or configure the instance 
owned by that user.</p>

<a name="sqlrelay"></a>
<span class="heading1">Accessing a Database With SQL Relay</span><br>

<p>Accessing DB2 from SQL Relay requires an instance entry in your 
<i>sqlrelay.conf</i> file for the database that you want 
to access.  Here is an example <i>sqlrelay.conf</i> which defines an SQL Relay 
instance called db2test.  This SQL Relay instance connects to the 
<i>testdb</i> database in the <i>db2inst1</i> DB2 instance.</p>

<p><b>Important Note:</b> For DB2 connections, <i>sqlr-start</i> must be run as
the user that owns the DB2 instance that it is running against.  In this 
example, the <i>db2inst1</i> user owns the <i>db2inst1</i> instance where the 
<i>testdb</i> database resides, so <i>sqlr-start</i> must be run as 
<i>db2inst1</i>.</p>

<PRE>
<FONT color=#0000ff>&lt;?</FONT><B><FONT color=#288a51>xml version=</FONT></B><FONT color=#ff00ff>&quot;1.0&quot;</FONT><FONT color=#0000ff>?&gt;</FONT>
<FONT color=#008a8e>&lt;!</FONT><B><FONT color=#a62828>DOCTYPE</FONT></B> instances <B><FONT color=#a62828>SYSTEM</FONT></B> <FONT color=#ff00ff>&quot;sqlrelay.dtd&quot;</FONT><FONT color=#008a8e>&gt;</FONT>
<FONT color=#008a8e>&lt;instances&gt;</FONT>

        <FONT color=#008a8e>&lt;instance id=</FONT><FONT color=#ff00ff>&quot;db2test&quot;</FONT><FONT color=#008a8e> port=</FONT><FONT color=#ff00ff>&quot;9000&quot;</FONT><FONT color=#008a8e> socket=</FONT><FONT color=#ff00ff>&quot;/tmp/db2test.socket&quot;</FONT><FONT color=#008a8e> dbase=</FONT><FONT color=#ff00ff>&quot;db2&quot;</FONT><FONT color=#008a8e> connections=</FONT><FONT color=#ff00ff>&quot;3&quot;</FONT><FONT color=#008a8e> maxconnections=</FONT><FONT color=#ff00ff>&quot;5&quot;</FONT><FONT color=#008a8e> maxqueuelength=</FONT><FONT color=#ff00ff>&quot;0&quot;</FONT><FONT color=#008a8e> growby=</FONT><FONT color=#ff00ff>&quot;1&quot;</FONT><FONT color=#008a8e> ttl=</FONT><FONT color=#ff00ff>&quot;60&quot;</FONT><FONT color=#008a8e> endofsession=</FONT><FONT color=#ff00ff>&quot;commit&quot;</FONT><FONT color=#008a8e> sessiontimeout=</FONT><FONT color=#ff00ff>&quot;600&quot;</FONT><FONT color=#008a8e> runasuser=</FONT><FONT color=#ff00ff>&quot;db2inst1&quot;</FONT><FONT color=#008a8e> runasgroup=</FONT><FONT color=#ff00ff>&quot;db2inst1&quot;</FONT><FONT color=#008a8e> cursors=</FONT><FONT color=#ff00ff>&quot;5&quot;</FONT><FONT color=#008a8e> authtier=</FONT><FONT color=#ff00ff>&quot;listener&quot;</FONT><FONT color=#008a8e> handoff=</FONT><FONT color=#ff00ff>&quot;pass&quot;</FONT><FONT color=#008a8e>&gt;</FONT>
                <FONT color=#008a8e>&lt;users&gt;</FONT>
                        <FONT color=#008a8e>&lt;user user=</FONT><FONT color=#ff00ff>&quot;testuser&quot;</FONT><FONT color=#008a8e> password=</FONT><FONT color=#ff00ff>&quot;testpassword&quot;</FONT><FONT color=#008a8e>/&gt;</FONT>
                <FONT color=#008a8e>&lt;/users&gt;</FONT>
                <FONT color=#008a8e>&lt;connections&gt;</FONT>
                        <FONT color=#008a8e>&lt;connection connectionid=</FONT><FONT color=#ff00ff>&quot;db2test&quot;</FONT><FONT color=#008a8e> string=</FONT><FONT color=#ff00ff>&quot;db=testdb&quot;</FONT><FONT color=#008a8e> metric=</FONT><FONT color=#ff00ff>&quot;1&quot;</FONT><FONT color=#008a8e>/&gt;</FONT>
                <FONT color=#008a8e>&lt;/connections&gt;</FONT>
        <FONT color=#008a8e>&lt;/instance&gt;</FONT>

<FONT color=#008a8e>&lt;/instances&gt;</FONT>
</PRE>

<p>Now you can start up this instance with the following command.</p>

<blockquote>
<b>su - db2inst1 -c "sqlr-start -id db2test"</b>
</blockquote>

<p>To connect to the instance and run queries, use the following command.</p>

<blockquote>
<b>sqlrsh -id db2test</b>
</blockquote>

<p>The following command shuts down the SQL Relay instance.</p>

<blockquote>
<b>su - db2inst1 -c "sqlr-stop db2test"</b>
</blockquote>

</body>

</html>