Sophie

Sophie

distrib > PLD > ac > amd64 > media > dist > by-pkgid > b0e04678ee8c5e98fe90f32ac8be92ce > files > 65

unixODBC-2.2.12-2.amd64.rpm

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="Author" content="Peter Harvey">
   <meta name="GENERATOR" content="Mozilla/4.72C-CCK-MCD Caldera Systems OpenLinux [en] (X11; U; Linux 2.2.14 i686) [Netscape]">
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" alink="#FF0000">
<img SRC="unixODBC.gif" height=32 width=32><font face="Arial,Helvetica"><font size=+4>unixODBC</font></font>
<br>
<hr WIDTH="100%">
<center><b><font face="Arial,Helvetica"><font size=+2>USING THE TEXT FILE
DRIVER</font></font></b></center>

<p><br>
<p><font face="Arial,Helvetica">Welcome to the unixODBC User Manual.&nbsp;
This manual is targeted toward people who will be using unixODBC to access
data sources from tools and applications which have been developed by others.
This manual compliments the <a href="../AdministratorManual/">Administrator
Manual</a> and the <a href="../ProgrammerManual/">Programmer Manual</a>,
each of which is geared for a more technical audience.</font>
<p><b><font face="Arial,Helvetica"><font size=+1>Getting Started</font></font></b>
<p><font face="Arial,Helvetica">At this point unixODBC has been installed
by your System Administrator. Your System Administrator should have installed
and registered at least one ODBC Driver (we will assume that the ODBC Text
File Driver has been installed). Your System Administrator accomplished
this by following the directions laid out in the Administrator Manual.</font>
<p><font face="Arial,Helvetica">You will need an account on the UNIX/Linux
machine; this is also provided by your System Administrator. In fact, if
you run into problems at any point in this manual then you should refer
to your System Administrator to ensure that all required software is installed,
accounts given and privileges granted. You may also want to talk to your
Database Administrator (DBA) to ensure that you have access to your database
and to resolve any questions about which driver to use and what options
to set.</font>
<p><font face="Arial,Helvetica">UNIX users can be given a wide variety
of methods to access their account resources and these access methods usually
fall into one of two categories.</font>
<p><font face="Arial,Helvetica">1. shell account (telnet and terminal sessions)</font>
<br><font face="Arial,Helvetica">2. graphical desktop</font>
<p><font face="Arial,Helvetica">If you are limited to a shell account then
you will not be able to use the ODBCConfig and the DataManager tools.</font>
<p><font face="Arial,Helvetica">We are now ready to start using the unixODBC
tools. The first thing you should do is verify that you have a working
System DSN. If you do not; then you should create a User DSN. These tasks
can be accomplished using the ODBCConfig tool.</font>
<p><b><font face="Arial,Helvetica"><font size=+1>Using ODBCConfig</font></font></b>
<p><font face="Arial,Helvetica">The ODBCConfig tool is designed to allow
you to easily setup a Data Source (DSN). DSN's act as an access point for
getting to your data. In many cases; creating a DSN is as simple as picking
a Driver to use, selecting a Server, and entering a Name for the DSN. In
fact; DSN stands for Data Source Name.</font>
<p><font face="Arial,Helvetica">You should find using the ODBCConfig tool
to be quite intuitive because of the simple Graphical User Interface (see
Figure 1) but you must understand a few terms before getting started.</font>
<br>&nbsp;
<center><table BORDER NOSAVE >
<tr NOSAVE>
<td NOSAVE></td>
</tr>

<tr>
<td>
<center>Figure 1</center>
</td>
</tr>
</table></center>

<p><b><i><font face="Arial,Helvetica">User DSN</font></i></b>
<p><font face="Arial,Helvetica">These are your personal Data Sources. You
are able to; Add new ones, Remove existing ones, and Configure existing
ones. User DSN information is stored in a secret location where only you
can access them. Keeping your User DSN's separate from other User DSN's
allows you a great deal of flexibility and control over creating and working
with Data Sources which are only important to you.</font>
<p><b><i><font face="Arial,Helvetica">System DSN</font></i></b>
<p><font face="Arial,Helvetica">These are created by the System Administrator.
They act very much like the User DSN's but with three important differences.</font>
<p><font face="Arial,Helvetica">1. ONLY the System Administrator can; Add,
Remove and Configure System DSN's.</font>
<br><font face="Arial,Helvetica">2. System DSN's will be used only if the
DSN does not exist as a User DSN. In other words; your User DSN has precedence
over the System DSN.</font>
<br><font face="Arial,Helvetica">3. Everyone, logged into the ODBC enabled
computer, shares the same list of System DSN's.</font>
<p><b><i><font face="Arial,Helvetica">Drivers</font></i></b>
<p><font face="Arial,Helvetica">Drivers contain the special code required
to talk to the specific type of database you will work with. The Drivers
often come from the vendor of the database but may also be found in the
unixODBC package. Your System Administrator is the only user who can install
and register a Driver. You will select a Driver to use when adding a new
DSN.</font>
<p><b><i><font face="Arial,Helvetica">Add a DSN</font></i></b>
<p><font face="Arial,Helvetica">You will want to ensure that you have at
least one working DSN. Here is a quick step-by-step guide to creating your
first User DSN. We will not actually use it yet because that will involve
using other tools and we have not talked about them yet.</font>
<p><font face="Arial,Helvetica">1. Execute ODBCConfig</font>
<p><font face="Arial,Helvetica">This can be done in a variety of ways.
If you know that you have an icon or menu item for ODBCConfig on your desktop
then execute it using one of these methods. If you do not; then start a
shell and enter the command <font color="#CC33CC">ODBCConfig</font><font color="#000000">.
You should see a window popup (see Figure 1).</font></font>
<p><font face="Arial,Helvetica"><font color="#000000">2. Add</font></font>
<p><font face="Arial,Helvetica"><font color="#000000">Click on the User
DSN tab to ensure that you are working with User DSNs. Click on the Add
button. Select a Driver from the list. If the list is empty then contact
your System Administrator; only the System Administrator can add Drivers.
For this example we will try to use the Text File Driver. Select the Text
File Driver if you have it available.</font></font>
<p><font face="Arial,Helvetica"><font color="#000000">3. Edit Options</font></font>
<p><font face="Arial,Helvetica"><font color="#000000">You should be presented
with a list of DSN options which you can edit.&nbsp; Figure 2 shows the
options for the Text File Driver but you may have a different set of options
if you selected a different driver. Common options are; Name (a unique
name must be entered). Description, Trace and TraceFile.</font></font>
<br>&nbsp;
<br>&nbsp;
<center><table BORDER NOSAVE >
<tr>
<td></td>
</tr>

<tr>
<td>
<center>Figure 2</center>
</td>
</tr>
</table></center>

<p><font face="Arial,Helvetica"><font color="#000000">Enter a unique name,
enter a comment, turn Trace off and click Ok to save it. You may click
on Configure, at the main window, to come back to these options at any
time in the future. Notice that the Database in Figure-2 is /home/pharvey/test.db.
You should ensure that this points to something like; /home/YourLoginID/test.db
where you replace YourLoginID with your ID. The test.db file should not
already exist (for the purposes of this excercise); it will be created
for you. This is how to create a new database using the ODBC Text File
Driver.</font></font>
<p><font face="Arial,Helvetica"><font color="#000000">4. Your Done</font></font>
<p><font face="Arial,Helvetica"><font color="#000000">Notice that you now
have your new DSN listed in the main form. This means that you can try
to use it in any tool or application which uses ODBC DSNs for data access.
This includes many applications such as Word Processors and Spread Sheets.
You may want to test your DSN using the DataManager.</font></font>
<p><b><i><font face="Arial,Helvetica"><font color="#000000">Summary</font></font></i></b>
<p><font face="Arial,Helvetica"><font color="#000000">ODBCConfig is a useful
tool for PowerUsers but it is simple enough for almost any user to use.
ODBCConfig exposes the most important reason for using ODBC to access your
data; the ability for you or your System Administrator to change the Data
Source for your tools and applications. Please take some time to get familiar
with ODBCConfig and your Driver options, perhaps sit with someone who is
a bit more technical and talk about it for one or two minutes. You will
be rewarded.</font></font>
<p><b><font face="Arial,Helvetica"><font size=+1>Using DataManager</font></font></b>
<p><font face="Arial,Helvetica">The DataManager is a great, graphical,
tool for exploring your Data Sources. It allows you to explore you Data
Sources in a similar manner to exploring your file system. The DataManager
( see Figure 6 ) is split into two views. On the left hand side you have
a Tree View'. The Tree View is where you can drill down to the information
that interests you. On the right hand side you have a Detail View. The
Detail View shows any details that may be available for the selected item
in the Tree View.</font>
<p><font face="Arial,Helvetica">Just like ODBCConfig, you can execute the
DataManager in a variety of ways. One way is to go to a shell and enter
the command <font color="#CC66CC">DataManager</font>. This should bring
up a window that looks similar to Figure 6.</font>
<br>&nbsp;
<center><table BORDER NOSAVE >
<tr>
<td></td>
</tr>

<tr>
<td>
<center>Figure 6</center>
</td>
</tr>
</table></center>

<p><font face="Arial,Helvetica">Next; expand the nodes to drill down to
the information that interests you. You will be asked to login if you try
to drill past a Data Source. If this happens, enter the login ID and Password
provided by your Database Administrator or System Administrator. You will
know that you are logged in when the little computer screen changes from
Red to Green.</font>
<p><font face="Arial,Helvetica">One of the interesting Detail Views occurs
when you select a Data Source item in the Tree View when you are logged
into it (the little computer screen is Green). The Detail View is an SQL
editor. This is only useful if you know the SQL command language but for
those that do... it can be very handy.</font>
<p><b><i><font face="Arial,Helvetica">Summary</font></i></b>
<p><font face="Arial,Helvetica">The DataManager tool is a good way to test
a DSN and then to see what resources are available inside the Data Source.
It is also very easy to use.</font>
<br>&nbsp;
<p><b><font face="Arial,Helvetica"><font size=+1>Using isql</font></font></b>
<p><font face="Arial,Helvetica">This is a command line tool. This means
that you can use it even if you are not working on a Graphical Desktop
(for example; in a telnet session). This tool is designed for more advanced
uses of unixODBC. You can use isql to test a connection but it is designed
to be used by those experienced with the Structured Query Language (SQL).
You probably will not want to use this tool if you are unfamiliar with
SQL.</font>
<p><font face="Arial,Helvetica">isql allows you to;</font>
<p><font face="Arial,Helvetica">1. connect to your Data Source (using a
DSN)</font>
<br><font face="Arial,Helvetica">2. send SQL commands to the Data Source</font>
<br><font face="Arial,Helvetica">3. receive results from the Data Source</font>
<p><font face="Arial,Helvetica">This tool can act in batch mode or interactive
mode. Figure 3 shows a simple, interactive, session.</font>
<br>&nbsp;
<br>&nbsp;
<center><table BORDER NOSAVE >
<tr NOSAVE>
<td NOSAVE></td>
</tr>

<tr>
<td>
<center>Figure 3</center>
</td>
</tr>
</table></center>

<p><font face="Arial,Helvetica">Figure 4 shows an example of isql being
used in batch mode. Notice that it is being told to run a similar query
as above but this time it is coming from a file ( My.sql ).</font>
<br>&nbsp;
<br>&nbsp;
<center><table BORDER NOSAVE >
<tr>
<td></td>
</tr>

<tr>
<td>
<center>Figure 4</center>
</td>
</tr>
</table></center>

<p><font face="Arial,Helvetica">The example, in Figure 4, is also formatting
the results into an HTML table and is sending them to a new file ( My.html
). Figure 5 shows the resulting html table.</font>
<br>&nbsp;
<center><table NOSAVE >
<tr>
<td>
<center><table BORDER NOSAVE >
<tr BGCOLOR="#000099">
<td><font face="Arial,Helvetica"><font color="#FFFFFF">vcCompanyName</font></font></td>

<td><font face="Arial,Helvetica"><font color="#FFFFFF">vcCompanyStreet</font></font></td>

<td><font face="Arial,Helvetica"><font color="#FFFFFF">vcCompanyCity</font></font></td>

<td><font face="Arial,Helvetica"><font color="#FFFFFF">vcCompanyProvince</font></font></td>

<td><font face="Arial,Helvetica"><font color="#FFFFFF">vcCompanyPostalCode</font></font></td>
</tr>

<tr NOSAVE>
<td><font face="Arial,Helvetica">XYZ Company</font></td>

<td NOSAVE><font face="Arial,Helvetica">XYZ Street</font></td>

<td></td>

<td></td>

<td></td>
</tr>

<tr>
<td><font face="Arial,Helvetica">Another Company</font></td>

<td></td>

<td></td>

<td></td>

<td></td>
</tr>

<tr>
<td><font face="Arial,Helvetica">CodeByDesign</font></td>

<td></td>

<td></td>

<td></td>

<td></td>
</tr>
</table></center>
</td>
</tr>

<tr NOSAVE>
<td NOSAVE>
<center>Figure 5</center>
</td>
</tr>
</table></center>
<b><i><font face="Arial,Helvetica">Summary</font></i></b>
<p><font face="Arial,Helvetica">isql is a powerful tool for working SQL
to access your Data Source but it is more for the advanced user.</font>
<p><b><font face="Arial,Helvetica"><font size=+1>StarOffice 5</font></font></b>
<p><font face="Arial,Helvetica">StarOffice is an application similar in
goals to MS Office. A free version, for non-commercial use, can be downloaded
from <a href="http://www.stardivision.com" target-"_top">StarDivisions
web site</a>. Figure 7 shows a PostgreSQL table being browsed in StarOffice.
StarOffice can use ODBC data but it can be tricky to get going. Here are
some things to note about using StarOffice with unixODBC. Make sure that
unixODBC is installed on your machine before trying to use StarOffice ODBC
on UNIX.</font>
<br>&nbsp;
<center><table BORDER NOSAVE >
<tr NOSAVE>
<td NOSAVE></td>
</tr>

<tr>
<td>
<center>Figure 7</center>
</td>
</tr>
</table></center>

<p><font face="Arial,Helvetica">Q. StarOffice disappears when I try to
load a list of ODBC DSNs and I get an error in my terminal window about
some library file missing?</font>
<p>A. If you have StarOffice 5.0 you may want to try adding this to your
soffice start script <i><b>export LD_PRELOAD=/usr/lib/libodbc.so</b>&nbsp;
</i>Your soffice start script can be found in<i> <b>Office50/bin/soffice</b></i>and
can be edited with any text editor. If you are not sure of where libodbc.so
is or where soffice is then you may want to use the UNIX <b><i>find
</i></b>command.
<p>However with the release of StarOffice 5.1 and beyond all you need to
do is to add the path to the libodbc.so to either /etc/ld.so.conf or to
your LD_LIBRARY_PATH environment variable.
<p>Q. Do all ODBC drivers work with StarOffice?
<p>A. No. StarOffice is very demanding upon an ODBC driver. StarOffice
needs many ODBC features in order to accept a driver. Two drivers which
are known to work are; 1. PostgreSQL and 2. MySQL. People are actively
working on other drivers.
<p><b><i><font face="Arial,Helvetica">Summary</font></i></b>
<p><font face="Arial,Helvetica">StarOffice is a rising 'star' in the UNIX
world. You can combine StarOffice with unixODBC to get at your data. With
StarOffice and unixODBC you can pull your data into a Spreadsheet, Word
Processor or even create Web forms based upon your data.</font>
<p><b><font face="Arial,Helvetica"><font size=+1>Conclusion</font></font></b>
<p><font face="Arial,Helvetica">unixODBC comes with a variety of useful
and powerful tools to allow you to configure you ODBC access and to work
with your ODBC data. Familiarity with these tools is a great start to using
your ODBC in applications such as word processors, spreadsheets and even
applications developed at your company of employ. I hope you enjoy them!
Please email comments and/or suggestions to me, <a href="mailto:pharvey@codebydesign.com">Peter
Harvey</a>.</font>
<p>
<hr WIDTH="100%">
<br>&nbsp;
<br>&nbsp;
</body>
</html>