DB2 10.5 for Linux, UNIX, and Windows

CREATE WRAPPER statement

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

Read syntax diagramSkip visual syntax diagram
>>-CREATE WRAPPER--wrapper-name--+-----------------------+------>
                                 '-LIBRARY--library-name-'   

>--+---------------------------------------------------------+-><
   |             .-,------------------------------------.    |   
   |             V                                      |    |   
   '-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 following subdirectory of your database's installation path:
Operating system Subdirectory for the wrapper library module
Linux
AIX®
Solaris
HP-UX
lib
Windows bin

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
Indicates what wrapper options are to be enabled or reset.
wrapper-option-name
Names a wrapper option that is to be enabled or reset.
string-constant
Specifies the setting for wrapper-option-name as a character string constant. 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.

Notes

Examples

  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
  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')
  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'