Contents
|
Data
Architect
Professional database modeling |
Chapter 13
ODBC
About this chapter
This chapter describes Open Database Connectivity(ODBC).
Open Database Connectivity
(ODBC) is the most common method to access data when an application
needs to be able to work with databases from many different vendors.
All major database vendors provide a way to access their database
through the use of ODBC. All Microsoft Windows machines have an ODBC
sub-system installed by default and ODBC is availible for all major
operating systems. Most Linux distributions have ODBC (usually
unixODBC) but it may not be installed by default.
ODBC must exist in order for
Data Architect to work.
This brief document provides a quick start to understanding and using
ODBC - it is not meant to be a substitute for the ODBC documentation
which comes with an ODBC sub-system.
|
There are several ODBC sub-systems
availible for Linux. The two most popular are; iODBC and unixODBC. One
or both of these are probably in your favourite Linux distribution but
may not be installed by default. unixODBC is recommended because
development is done using unixODBC, and because it has
several drivers to get things started. Whatever you choose please be
aware that you should not have more than one ODBC sub-system installed.
|
|
MS Windows has been shipping with
an ODBC sub-system for years. It is well documented and fairly complete.
MS even includes several drivers.
|
|
Apple has never had very good
support for ODBC but that has changed with OSX 10.2. Jaguar installs a
form of iODBC by default. Unfortunately no drivers are installed with
it.
|
Driver
ODBC Drivers provide the
'glue' which allows the application to communicate with the data source
- just as a Printer driver allows the application to communicate with
the Printer. This means that an ODBC driver must be installed AND
registered before the application can access the data source.
Unfortunately; how a driver is installed varies widely depending upon
the vendor and platform. You will have to refer to your driver
documentation for more information.
Drivers are usually provided by the database vendor and are usually
included with the database system. However; in some cases you should get
your driver from another source. This is sometimes the case when the
'other' source provides a better driver or a driver bundle.
Data Source Name (DSN)
An application can access
the data source by talking directly to the driver but most
applications expect to use a DSN. A DSN is a name (used to refer to
the data source) and a few settings such as; server name, database etc.
The settings vary slightly between drivers so you may want to check
with the drivers documentation for details.
Most ODBC sub-systems have
a graphical tool to aid in creating a DSN. Some ODBC sub-systems have
command-line tools for advanced Users.
ODBC Administrator
The ODBC Administrator is
a graphical tool which aids the User in configurating the ODBC
sub-system. Common tasks are;
- register/unregister a
driver
- create/edit/delete a DSN
- set ODBC options
|
Linux machines running the
unixODBC sub-system have several methods to register an installed driver
and manage data source names. They are listed here in order of ease
of use; ODBCConfig, odbcinst, and a text editor. Refer to the
unixODBC (www.unixodbc.org) documentation for details. Note: Some Linux
distros (such as RedHat) have several RPM's for unixODBC - if possible
install all of them.
|
|
MS Windows Users should use the
ODBC Administrator to manage drivers and data source names. This program
can be found in the 'Control Panel'.
|
|
OSX, starting at v10.2, has an
ODBC Administrator in /Applications/Utilities. |
Data Architect has a menu
item and toolbar button
to quickly access your systems ODBC Administrator. This
allows the User to quickly and easily manage drivers and data source
names with a familiar tool. Figure 1 shows the ODBC Administrator
(ODBCConfig) from unixODBC.
|
figure 1
ODBC Administrator
|
Browse ODBC Sub-System
Data Architect contains an
ODBC Browser. This feature can be used to browse the ODBC sub-system
on your machine. This can be helpful when debugging problems with your
ODBC sub-system or just to learn more about what is availible in your
ODBC sub-system and data sources.
|
figure 2
ODBC Browser
|
ODBC Bridge
An ODBC Bridge allows software to communicate to a data source using a
driver which resides on another machine - usually on a different
operating system. For example; someone may be using an application on
OSX and have not been able to find an ODBC driver for their database
which works on OSX. In this case you install a driver on, for example,
XP and use a bridge driver on OSX. The bridge driver looks like a
regular ODBC driver to the OSX application but is really acting as a
type of relay to the XP machine where the calls make their way to the
desired ODBC driver.
See
Easysoft
Virtual Server
A Virtual Server ties together more than one data source. An
application uses an ODBC driver for the Virtual Server to communicate
with all of the databases as if they are a single database.
Resources