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 diagramCREATE WRAPPERwrapper-nameLIBRARYlibrary-nameOPTIONS(,wrapper-option-namestring-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
The name of the file that contains the wrapper library module. This option is required when a user-supplied wrapper name is used, and cannot be specified when a predefined wrapper name is used. The library name must be enclosed in single quotation marks.
The library name can be specified either as an absolute path name or as a base name (without the path). If a base name is specified, the library must 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
OPTIONS
Specify configuration options for the wrapper to be created. Which options you can specify depends on the data source of the object for which a wrapper is being created. For a list of data sources and the wrapper options that apply to each, see Data source options. Each option value is a character string constant that must be enclosed in single quotation marks.

Notes

  • Syntax alternatives: The following syntax is supported for compatibility with previous versions of Db2®:
    • ADD can be specified before wrapper-option-name string-constant.

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'