The CREATE WRAPPER statement registers a wrapper with
a federated server. A wrapper is a mechanism by which a federated
server can interact with certain types of data sources.
Invocation
This statement can be embedded
in an application program or issued through the use of dynamic SQL
statements. It is an executable statement that can be dynamically
prepared only if DYNAMICRULES run behavior is in effect for the package
(SQLSTATE 42509).
Authorization
The
privileges held by the authorization ID of the statement must include
DBADM authority.
Syntax
>>-CREATE WRAPPER--wrapper-name--+-----------------------+------>
'-LIBRARY--library-name-'
>--+------------------------------------------------------------------+-><
| .-,---------------------------------------------. |
| V .-ADD-. | |
'-OPTIONS--(----+-----+--wrapper-option-name--string-constant-+--)-'
Description
- wrapper-name
- Names the wrapper. It can be:
- A predefined name. If a predefined name is specified, the federated
server automatically assigns a default value to library-name.
- A user-supplied name. If a user-supplied name is provided, it
is necessary to also specify the appropriate library-name to
be used with that wrapper and operating system.
- LIBRARY library-name
- Names the file that contains the wrapper library module.
The
library name can be specified as an absolute path name or simply the
base name (without the path). If only the base name is specified,
the library should reside in the lib (UNIX) or the bin (Windows) subdirectory of the DB2® install path. The library-name must
be enclosed in single quotation marks.
The LIBRARY option is
only necessary when a user-supplied wrapper-name is
used. This option should not be used when a predefined wrapper-name is
given.
- OPTIONS (ADD wrapper-option-name string-constant,
...)
- Wrapper options are used to configure the wrapper or to define
how DB2 uses the wrapper. The wrapper-option-name is
the name of the option. The string-constant specifies
the setting for the wrapper option. The string-constant must
be enclosed in single quotation marks. Some wrapper options can be
used by all wrappers and some options are specific to a particular
wrapper.
Examples
Example
1: Register the NET8 wrapper on a federated server to access Oracle
data sources.
NET8 is the predefined name
for the wrapper that you can use to access Oracle data sources.
CREATE WRAPPER NET8
Example
2: Register a wrapper on a DB2 federated
server that uses the Linux operating
system to access ODBC data sources. Assign the name
odbc to
the wrapper that is being registered in the federated database. The
full path of the library that contains the ODBC Driver Manager is
defined in the wrapper option
MODULE '/usr/lib/odbc.so'.
CREATE WRAPPER odbc OPTIONS (MODULE '/usr/lib/odbc.so')
Example
3: Register a wrapper on a DB2 federated
server that uses the Windows operating
system to access ODBC data sources. The library name for the ODBC
wrapper is
'db2rcodbc.dll'.
CREATE WRAPPER odbc LIBRARY 'db2rcodbc.dll'