Debian Codegraph @

doc/UserManual/index.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <HTML>
3 <HEAD>
4 <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
5 <TITLE></TITLE>
6 <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0 (Linux)">
7 <META NAME="AUTHOR" CONTENT="Peter Harvey">
8 <META NAME="CREATED" CONTENT="20070322;14575800">
9 <META NAME="CHANGED" CONTENT="16010101;0">
10 <STYLE>
11 <!--
12 TD P { color: #000000 }
13 P { color: #000000 }
14 A:link { color: #0000ef }
15 A:visited { color: #51188e }
16 -->
17 </STYLE>
18 </HEAD>
19 <BODY LANG="en-US" TEXT="#000000" LINK="#0000ef" VLINK="#51188e" BGCOLOR="#ffffff" DIR="LTR">
20 <P STYLE="margin-bottom: 0in"><IMG SRC="unixODBC.gif" NAME="graphics1" ALIGN=BOTTOM WIDTH=32 HEIGHT=32 BORDER=0><FONT SIZE=7><FONT FACE="Arial, Helvetica">unixODBC</FONT></FONT>
21 </P>
22 <HR>
23 <P ALIGN=CENTER><FONT FACE="Arial, Helvetica"><FONT SIZE=5><B>USER
24 MANUAL</B></FONT></FONT></P>
25 <P><BR><BR>
26 </P>
27 <P><FONT FACE="Arial, Helvetica">Welcome to the unixODBC User
28 Manual.&nbsp; This manual is targeted toward people who will be using
29 unixODBC to access data sources from tools and applications which
30 have been developed by others. This manual compliments the
31 <A HREF="../AdministratorManual">Administrator Manual</A> and the
32 <A HREF="../ProgrammerManual">Programmer Manual</A>, each of which is
33 geared for a more technical audience.</FONT>
34 </P>
35 <P><B><FONT SIZE=4><FONT FACE="Arial, Helvetica">Getting Started</FONT></FONT></B>
36 </P>
37 <P><FONT FACE="Arial, Helvetica">At this point unixODBC has been
38 installed by your System Administrator. Your System Administrator
39 should have installed and registered at least one ODBC Driver (we
40 will assume that the ODBC Text File Driver has been installed). Your
41 System Administrator accomplished this by following the directions
42 laid out in the Administrator Manual.</FONT>
43 </P>
44 <P><FONT FACE="Arial, Helvetica">You will need an account on the
45 UNIX/Linux machine; this is also provided by your System
46 Administrator. In fact, if you run into problems at any point in this
47 manual then you should refer to your System Administrator to ensure
48 that all required software is installed, accounts given and
49 privileges granted. You may also want to talk to your Database
50 Administrator (DBA) to ensure that you have access to your database
51 and to resolve any questions about which driver to use and what
52 options to set.</FONT>
53 </P>
54 <P><FONT FACE="Arial, Helvetica">UNIX users can be given a wide
55 variety of methods to access their account resources and these access
56 methods usually fall into one of two categories.</FONT>
57 </P>
58 <P><FONT FACE="Arial, Helvetica">1. shell account (telnet and
59 terminal sessions)</FONT> <BR><FONT FACE="Arial, Helvetica">2.
60 graphical desktop</FONT>
61 </P>
62 <P><FONT FACE="Arial, Helvetica">If you are limited to a shell
63 account then you will not be able to use the ODBCConfig and the
64 DataManager tools.</FONT>
65 </P>
66 <P><FONT FACE="Arial, Helvetica">We are now ready to start using the
67 unixODBC tools. The first thing you should do is verify that you have
68 a working System DSN. If you do not; then you should create a User
69 DSN. These tasks can be accomplished using the ODBCConfig tool.</FONT>
70 </P>
71 <P><B><FONT SIZE=4><FONT FACE="Arial, Helvetica">Using ODBCConfig</FONT></FONT></B>
72 </P>
73 <P><FONT FACE="Arial, Helvetica">The ODBCConfig tool is designed to
74 allow you to easily setup a Data Source (DSN). DSN's act as an access
75 point for getting to your data. In many cases; creating a DSN is as
76 simple as picking a Driver to use, selecting a Server, and entering a
77 Name for the DSN. In fact; DSN stands for Data Source Name.</FONT>
78 </P>
79 <P><FONT FACE="Arial, Helvetica">You should find using the ODBCConfig
80 tool to be quite intuitive because of the simple Graphical User
81 Interface (see Figure 1) but you must understand a few terms before
82 getting started.</FONT> <BR>&nbsp;
83 </P>
84 <CENTER>
85 <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=2>
86 <TR>
87 <TD>
88 <P><BR>
89 </P>
90 </TD>
91 </TR>
92 <TR>
93 <TD>
94 <P ALIGN=CENTER>Figure 1</P>
95 </TD>
96 </TR>
97 </TABLE>
98 </CENTER>
99 <P><B><I><FONT FACE="Arial, Helvetica">User DSN</FONT></I></B>
100 </P>
101 <P><FONT FACE="Arial, Helvetica">These are your personal Data
102 Sources. You are able to; Add new ones, Remove existing ones, and
103 Configure existing ones. User DSN information is stored in a secret
104 location where only you can access them. Keeping your User DSN's
105 separate from other User DSN's allows you a great deal of flexibility
106 and control over creating and working with Data Sources which are
107 only important to you.</FONT>
108 </P>
109 <P><B><I><FONT FACE="Arial, Helvetica">System DSN</FONT></I></B>
110 </P>
111 <P><FONT FACE="Arial, Helvetica">These are created by the System
112 Administrator. They act very much like the User DSN's but with three
113 important differences.</FONT>
114 </P>
115 <P><FONT FACE="Arial, Helvetica">1. ONLY the System Administrator
116 can; Add, Remove and Configure System DSN's.</FONT> <BR><FONT FACE="Arial, Helvetica">2.
117 System DSN's will be used only if the DSN does not exist as a User
118 DSN. In other words; your User DSN has precedence over the System
119 DSN.</FONT> <BR><FONT FACE="Arial, Helvetica">3. Everyone, logged
120 into the ODBC enabled computer, shares the same list of System DSN's.</FONT>
121 </P>
122 <P><B><I><FONT FACE="Arial, Helvetica">Drivers</FONT></I></B>
123 </P>
124 <P><FONT FACE="Arial, Helvetica">Drivers contain the special code
125 required to talk to the specific type of database you will work with.
126 The Drivers often come from the vendor of the database but may also
127 be found in the unixODBC package. Your System Administrator is the
128 only user who can install and register a Driver. You will select a
129 Driver to use when adding a new DSN.</FONT>
130 </P>
131 <P><B><I><FONT FACE="Arial, Helvetica">Add a DSN</FONT></I></B>
132 </P>
133 <P><FONT FACE="Arial, Helvetica">You will want to ensure that you
134 have at least one working DSN. Here is a quick step-by-step guide to
135 creating your first User DSN. We will not actually use it yet because
136 that will involve using other tools and we have not talked about them
137 yet.</FONT>
138 </P>
139 <P><FONT FACE="Arial, Helvetica">1. Execute ODBCConfig</FONT>
140 </P>
141 <P><FONT FACE="Arial, Helvetica">This can be done in a variety of
142 ways. If you know that you have an icon or menu item for ODBCConfig
143 on your desktop then execute it using one of these methods. If you do
144 not; then start a shell and enter the command <FONT COLOR="#cc33cc">ODBCConfig</FONT><FONT COLOR="#000000">.
145 You should see a window popup (see Figure 1).</FONT></FONT>
146 </P>
147 <P><FONT FACE="Arial, Helvetica"><FONT COLOR="#000000">2. Add</FONT></FONT>
148 </P>
149 <P><FONT FACE="Arial, Helvetica"><FONT COLOR="#000000">Click on the
150 User DSN tab to ensure that you are working with User DSNs. Click on
151 the Add button. Select a Driver from the list. If the list is empty
152 then contact your System Administrator; only the System Administrator
153 can add Drivers. For this example we will try to use the Text File
154 Driver. Select the Text File Driver if you have it available.</FONT></FONT>
155 </P>
156 <P><FONT FACE="Arial, Helvetica"><FONT COLOR="#000000">3. Edit
157 Options</FONT></FONT>
158 </P>
159 <P><FONT FACE="Arial, Helvetica"><FONT COLOR="#000000">You should be
160 presented with a list of DSN options which you can edit.&nbsp; Figure
161 2 shows the options for the Text File Driver but you may have a
162 different set of options if you selected a different driver. Common
163 options are; Name (a unique name must be entered). Description, Trace
164 and TraceFile.</FONT></FONT> <BR>&nbsp; <BR>&nbsp;
165 </P>
166 <CENTER>
167 <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=2>
168 <TR>
169 <TD>
170 <P><BR>
171 </P>
172 </TD>
173 </TR>
174 <TR>
175 <TD>
176 <P ALIGN=CENTER>Figure 2</P>
177 </TD>
178 </TR>
179 </TABLE>
180 </CENTER>
181 <P><FONT FACE="Arial, Helvetica"><FONT COLOR="#000000">Enter a unique
182 name, enter a comment, turn Trace off and click Ok to save it. You
183 may click on Configure, at the main window, to come back to these
184 options at any time in the future. Notice that the Database in
185 Figure-2 is /home/pharvey/test.db. You should ensure that this points
186 to something like; /home/YourLoginID/test.db where you replace
187 YourLoginID with your ID. The test.db file should not already exist
188 (for the purposes of this exercise); it will be created for you.
189 This is how to create a new database using the ODBC Text File Driver.</FONT></FONT>
190 </P>
191 <P><FONT FACE="Arial, Helvetica"><FONT COLOR="#000000">4. Your Done</FONT></FONT>
192 </P>
193 <P><FONT FACE="Arial, Helvetica"><FONT COLOR="#000000">Notice that
194 you now have your new DSN listed in the main form. This means that
195 you can try to use it in any tool or application which uses ODBC DSNs
196 for data access. This includes many applications such as Word
197 Processors and Spread Sheets. You may want to test your DSN using the
198 DataManager.</FONT></FONT>
199 </P>
200 <P><B><I><FONT FACE="Arial, Helvetica"><FONT COLOR="#000000">Summary</FONT></FONT></I></B>
201 </P>
202 <P><FONT FACE="Arial, Helvetica"><FONT COLOR="#000000">ODBCConfig is
203 a useful tool for PowerUsers but it is simple enough for almost any
204 user to use. ODBCConfig exposes the most important reason for using
205 ODBC to access your data; the ability for you or your System
206 Administrator to change the Data Source for your tools and
207 applications. Please take some time to get familiar with ODBCConfig
208 and your Driver options, perhaps sit with someone who is a bit more
209 technical and talk about it for one or two minutes. You will be
210 rewarded.</FONT></FONT>
211 </P>
212 <P><B><FONT SIZE=4><FONT FACE="Arial, Helvetica">Using DataManager</FONT></FONT></B>
213 </P>
214 <P><FONT FACE="Arial, Helvetica">The DataManager is a great,
215 graphical, tool for exploring your Data Sources. It allows you to
216 explore you Data Sources in a similar manner to exploring your file
217 system. The DataManager ( see Figure 6 ) is split into two views. On
218 the left hand side you have a Tree View'. The Tree View is where you
219 can drill down to the information that interests you. On the right
220 hand side you have a Detail View. The Detail View shows any details
221 that may be available for the selected item in the Tree View.</FONT>
222 </P>
223 <P><FONT FACE="Arial, Helvetica">Just like ODBCConfig, you can
224 execute the DataManager in a variety of ways. One way is to go to a
225 shell and enter the command <FONT COLOR="#cc66cc">DataManager</FONT>.
226 This should bring up a window that looks similar to Figure 6.</FONT>
227 <BR>&nbsp;
228 </P>
229 <CENTER>
230 <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=2>
231 <TR>
232 <TD>
233 <P><BR>
234 </P>
235 </TD>
236 </TR>
237 <TR>
238 <TD>
239 <P ALIGN=CENTER>Figure 6</P>
240 </TD>
241 </TR>
242 </TABLE>
243 </CENTER>
244 <P><FONT FACE="Arial, Helvetica">Next; expand the nodes to drill down
245 to the information that interests you. You will be asked to login if
246 you try to drill past a Data Source. If this happens, enter the login
247 ID and Password provided by your Database Administrator or System
248 Administrator. You will know that you are logged in when the little
249 computer screen changes from Red to Green.</FONT>
250 </P>
251 <P><FONT FACE="Arial, Helvetica">One of the interesting Detail Views
252 occurs when you select a Data Source item in the Tree View when you
253 are logged into it (the little computer screen is Green). The Detail
254 View is an SQL editor. This is only useful if you know the SQL
255 command language but for those that do... it can be very handy.</FONT>
256 </P>
257 <P><B><I><FONT FACE="Arial, Helvetica">Summary</FONT></I></B>
258 </P>
259 <P><FONT FACE="Arial, Helvetica">The DataManager tool is a good way
260 to test a DSN and then to see what resources are available inside the
261 Data Source. It is also very easy to use.</FONT> <BR>&nbsp;
262 </P>
263 <P><B><FONT SIZE=4><FONT FACE="Arial, Helvetica">Using isql</FONT></FONT></B>
264 </P>
265 <P><FONT FACE="Arial, Helvetica">This is a command line tool. This
266 means that you can use it even if you are not working on a Graphical
267 Desktop (for example; in a telnet session). This tool is designed for
268 more advanced uses of unixODBC. You can use isql to test a connection
269 but it is designed to be used by those experienced with the
270 Structured Query Language (SQL). You probably will not want to use
271 this tool if you are unfamiliar with SQL.</FONT>
272 </P>
273 <P><FONT FACE="Arial, Helvetica">isql allows you to;</FONT>
274 </P>
275 <P><FONT FACE="Arial, Helvetica">1. connect to your Data Source
276 (using a DSN)</FONT> <BR><FONT FACE="Arial, Helvetica">2. send SQL
277 commands to the Data Source</FONT> <BR><FONT FACE="Arial, Helvetica">3.
278 receive results from the Data Source</FONT>
279 </P>
280 <P><FONT FACE="Arial, Helvetica">This tool can act in batch mode or
281 interactive mode. Figure 3 shows a simple, interactive, session.</FONT>
282 <BR>&nbsp; <BR>&nbsp;
283 </P>
284 <CENTER>
285 <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=2>
286 <TR>
287 <TD>
288 <P><BR>
289 </P>
290 </TD>
291 </TR>
292 <TR>
293 <TD>
294 <P ALIGN=CENTER>Figure 3</P>
295 </TD>
296 </TR>
297 </TABLE>
298 </CENTER>
299 <P><FONT FACE="Arial, Helvetica">Figure 4 shows an example of isql
300 being used in batch mode. Notice that it is being told to run a
301 similar query as above but this time it is coming from a file (
302 My.sql ).</FONT> <BR>&nbsp; <BR>&nbsp;
303 </P>
304 <CENTER>
305 <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=2>
306 <TR>
307 <TD>
308 <P><BR>
309 </P>
310 </TD>
311 </TR>
312 <TR>
313 <TD>
314 <P ALIGN=CENTER>Figure 4</P>
315 </TD>
316 </TR>
317 </TABLE>
318 </CENTER>
319 <P><FONT FACE="Arial, Helvetica">The example, in Figure 4, is also
320 formatting the results into an HTML table and is sending them to a
321 new file ( My.html ). Figure 5 shows the resulting html table.</FONT>
322 <BR>&nbsp;
323 </P>
324 <CENTER>
325 <TABLE WIDTH=679 BORDER=1 CELLPADDING=2 CELLSPACING=3 FRAME=VOID RULES=COLS>
326 <COL WIDTH=0>
327 <COL WIDTH=118>
328 <COL WIDTH=118>
329 <COL WIDTH=104>
330 <COL WIDTH=136>
331 <COL WIDTH=158>
332 <COL WIDTH=0>
333 <TBODY>
334 <TR>
335 <TD COLSPAN=7 WIDTH=669></TD>
336 </TR>
337 <TR>
338 <TD ROWSPAN=4 WIDTH=0 VALIGN=TOP></TD>
339 <TD WIDTH=118 BGCOLOR="#000099">
340 <P><FONT COLOR="#ffffff"><FONT FACE="Arial, Helvetica">vcCompanyName</FONT></FONT></P>
341 </TD>
342 <TD WIDTH=118 BGCOLOR="#000099">
343 <P><FONT COLOR="#ffffff"><FONT FACE="Arial, Helvetica">vcCompanyStreet</FONT></FONT></P>
344 </TD>
345 <TD WIDTH=104 BGCOLOR="#000099">
346 <P><FONT COLOR="#ffffff"><FONT FACE="Arial, Helvetica">vcCompanyCity</FONT></FONT></P>
347 </TD>
348 <TD WIDTH=136 BGCOLOR="#000099">
349 <P><FONT COLOR="#ffffff"><FONT FACE="Arial, Helvetica">vcCompanyProvince</FONT></FONT></P>
350 </TD>
351 <TD WIDTH=158 BGCOLOR="#000099">
352 <P><FONT COLOR="#ffffff"><FONT FACE="Arial, Helvetica">vcCompanyPostalCode</FONT></FONT></P>
353 </TD>
354 <TD ROWSPAN=4 WIDTH=0 VALIGN=TOP></TD>
355 </TR>
356 </TBODY>
357 <TBODY>
358 <TR>
359 <TD WIDTH=118>
360 <P><FONT FACE="Arial, Helvetica">XYZ Company</FONT></P>
361 </TD>
362 <TD WIDTH=118>
363 <P><FONT FACE="Arial, Helvetica">XYZ Street</FONT></P>
364 </TD>
365 <TD WIDTH=104>
366 <P><BR>
367 </P>
368 </TD>
369 <TD WIDTH=136>
370 <P><BR>
371 </P>
372 </TD>
373 <TD WIDTH=158>
374 <P><BR>
375 </P>
376 </TD>
377 </TR>
378 </TBODY>
379 <TBODY>
380 <TR>
381 <TD WIDTH=118>
382 <P><FONT FACE="Arial, Helvetica">Another Company</FONT></P>
383 </TD>
384 <TD WIDTH=118>
385 <P><BR>
386 </P>
387 </TD>
388 <TD WIDTH=104>
389 <P><BR>
390 </P>
391 </TD>
392 <TD WIDTH=136>
393 <P><BR>
394 </P>
395 </TD>
396 <TD WIDTH=158>
397 <P><BR>
398 </P>
399 </TD>
400 </TR>
401 </TBODY>
402 <TBODY>
403 <TR>
404 <TD WIDTH=118>
405 <P><FONT FACE="Arial, Helvetica">CodeByDesign</FONT></P>
406 </TD>
407 <TD WIDTH=118>
408 <P><BR>
409 </P>
410 </TD>
411 <TD WIDTH=104>
412 <P><BR>
413 </P>
414 </TD>
415 <TD WIDTH=136>
416 <P><BR>
417 </P>
418 </TD>
419 <TD WIDTH=158>
420 <P><BR>
421 </P>
422 </TD>
423 </TR>
424 <TR>
425 <TD COLSPAN=7 WIDTH=669></TD>
426 </TR>
427 <TR>
428 <TD COLSPAN=7 WIDTH=669>
429 <P ALIGN=CENTER>Figure 5</P>
430 </TD>
431 </TR>
432 </TBODY>
433 </TABLE>
434 </CENTER>
435 <P><B><I><FONT FACE="Arial, Helvetica">Summary</FONT></I></B>
436 </P>
437 <P><FONT FACE="Arial, Helvetica">isql is a powerful tool for working
438 SQL to access your Data Source but it is more for the advanced user.</FONT>
439 </P>
440 <P><B><FONT SIZE=4><FONT FACE="Arial, Helvetica">StarOffice 5</FONT></FONT></B>
441 </P>
442 <P><FONT FACE="Arial, Helvetica">StarOffice is an application similar
443 in goals to MS Office. A free version, for non-commercial use, can be
444 downloaded from <A HREF="http://www.stardivision.com/">StarDivisions
445 web site</A>. Figure 7 shows a PostgreSQL table being browsed in
446 StarOffice. StarOffice can use ODBC data but it can be tricky to get
447 going. Here are some things to note about using StarOffice with
448 unixODBC. Make sure that unixODBC is installed on your machine before
449 trying to use StarOffice ODBC on UNIX.</FONT> <BR>&nbsp;
450 </P>
451 <CENTER>
452 <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=2>
453 <TR>
454 <TD>
455 <P><BR>
456 </P>
457 </TD>
458 </TR>
459 <TR>
460 <TD>
461 <P ALIGN=CENTER>Figure 7</P>
462 </TD>
463 </TR>
464 </TABLE>
465 </CENTER>
466 <P><FONT FACE="Arial, Helvetica">Q. StarOffice disappears when I try
467 to load a list of ODBC DSNs and I get an error in my terminal window
468 about some library file missing?</FONT>
469 </P>
470 <P>A. If you have StarOffice 5.0 you may want to try adding this to
471 your soffice start script <I><B>export
472 LD_PRELOAD=/usr/lib/libodbc.so</B>&nbsp; </I>Your soffice start
473 script can be found in <B><I>Office50/bin/soffice</I></B>and can be
474 edited with any text editor. If you are not sure of where libodbc.so
475 is or where soffice is then you may want to use the UNIX <B><I>find
476 </I></B>command.
477 </P>
478 <P>However with the release of StarOffice 5.1 and beyond all you need
479 to do is to add the path to the libodbc.so to either /etc/ld.so.conf
480 or to your LD_LIBRARY_PATH environment variable.
481 </P>
482 <P>Q. Do all ODBC drivers work with StarOffice?
483 </P>
484 <P>A. No. StarOffice is very demanding upon an ODBC driver.
485 StarOffice needs many ODBC features in order to accept a driver. Two
486 drivers which are known to work are; 1. PostgreSQL and 2. MySQL.
487 People are actively working on other drivers.
488 </P>
489 <P><B><I><FONT FACE="Arial, Helvetica">Summary</FONT></I></B>
490 </P>
491 <P><FONT FACE="Arial, Helvetica">StarOffice is a rising 'star' in the
492 UNIX world. You can combine StarOffice with unixODBC to get at your
493 data. With StarOffice and unixODBC you can pull your data into a
494 Spreadsheet, Word Processor or even create Web forms based upon your
495 data.</FONT>
496 </P>
497 <P><B><FONT SIZE=4><FONT FACE="Arial, Helvetica">Conclusion</FONT></FONT></B>
498 </P>
499 <P><FONT FACE="Arial, Helvetica">unixODBC comes with a variety of
500 useful and powerful tools to allow you to configure you ODBC access
501 and to work with your ODBC data. Familiarity with these tools is a
502 great start to using your ODBC in applications such as word
503 processors, spreadsheets and even applications developed at your
504 company of employ. I hope you enjoy them! Please email comments
505 and/or suggestions to me, <A HREF="mailto:[email protected]">Peter
506 Harvey</A>.</FONT>
507 </P>
508 <HR>
509 <P><BR>&nbsp; <BR>&nbsp;
510 </P>
511 </BODY>
512 </HTML>