Wrappers are mechanisms by which the federated database
interacts with data sources. The federated database uses routines
stored in a library called a wrapper module to implement a
wrapper.
These routines allow the federated database to perform
operations such as connecting to a data source and retrieving data
from it iteratively. Typically, the federated instance owner uses
the CREATE WRAPPER statement to register a wrapper in the federated
database. You can register a wrapper as fenced or trusted using the
DB2_FENCED wrapper option.
You create one wrapper for each type
of data source that you want to access. For example, you want to access
three DB2® for z/OS® database tables, one DB2 for System i® table, two Informix® tables, and one Informix view.
In this case, you need to create one wrapper for the DB2 data
source objects and one wrapper for the Informix data
source objects. After these wrappers are registered in the federated
database, you can use these wrappers to access other objects from
those data sources. For example, you can use the DRDA® wrapper
with all DB2 family data source objects—DB2 Database for Linux®, UNIX®,
and Windows®, DB2 for z/OS, DB2 for System
i, and DB2 Server for VM and VSE.
You use the
server definitions and nicknames to identify the specifics (name,
location, and so forth) of each data source object.
A wrapper
performs many tasks. Some of these tasks are:
- It connects to the data source. The wrapper uses the standard
connection API of the data source.
- It submits queries to the data source.
- For data sources that support SQL, the query is submitted in SQL.
- For data sources that do not support SQL, the query is translated
into the native query language of the source or into a series of source
API calls.
- It receives results sets from the data source. The wrapper uses
the data source standard APIs for receiving results set.
- It responds to federated database queries about the default data
type mappings for a data source. The wrapper contains the default
type mappings that are used when nicknames are created for a data
source object. For relational wrappers, data type mappings that you
create override the default data type mappings. User-defined data
type mappings are stored in the global catalog.
- It responds to federated database queries about the default function
mappings for a data source. The federated database needs data type
mapping information for query planning purposes. The wrapper contains
information that the federated database needs to determine if DB2 functions
are mapped to functions of the data source, and how the functions
are mapped. This information is used by the SQL Compiler to determine
if the data source is able to perform the query operations. For relational
wrappers, function mappings that you create override the default function
type mappings. User-defined function mappings are stored in the global
catalog.
Wrapper options are used to configure the wrapper
or to define how IBM® InfoSphere™ Federation Server uses
the wrapper.