CREATE SERVER statement - Examples for the Db2 wrapper

Use the CREATE SERVER statement to register Db2 server definitions. This topic includes a complete example with the required options, and an example that shows the use of additional server options.

Complete example

The following example shows you how to register a server definition for a DRDA wrapper to a cataloged Db2 data source by using the CREATE SERVER statement:
CREATE SERVER DB2SERVER TYPE DB2/ZOS VERSION 7 WRAPPER DRDA
       AUTHORIZATION "spalten" PASSWORD "db2guru" 
       OPTIONS (DBNAME 'CLNTS390')
DB2SERVER
A name that you assign to the Db2 database server. Duplicate server definition names are not allowed. This is a required server option.
TYPE DB2/ZOS
Specifies the type of data source server to which you are configuring access.
VERSION 7
The version of the Db2 database server that you want to access.
Note: If you used Db2 for z/OS® Version 8 to create the database in compatibility mode, you must specify Version 7.
WRAPPER DRDA
The name that you specified in the CREATE WRAPPER statement.
AUTHORIZATION "spalten"
The authorization ID at the data source. This ID must have BINDADD authority at the data source. This value is case sensitive.
PASSWORD "db2guru"
The password that is associated with the authorization ID at the data source. This value is case sensitive.
DBNAME 'CLNTS390'
An alias for the Db2 database that you want to access. You defined this alias when you cataloged the database using the CATALOG DATABASE command. This value is case sensitive.

Although the database name variable, host, and port are specified as options in the CREATE SERVER statement, they are all required for Db2 data sources.

The following example shows you how to register a server definition for a DRDA wrapper to a Db2 data source that is not cataloged by using the CREATE SERVER statement:
CREATE SERVER DB2SERVER TYPE DB2/LUW VERSION 11 WRAPPER DRDA
  AUTHORIZATION "spalten" PASSWORD "db2guru"
  OPTIONS (HOST 'db2dev.ibm.com', PORT '50000', DBNAME 'CLNTS390')
DB2SERVER
A name that you assign to the Db2 database server. Duplicate server definition names are not allowed. This is a required server option.
TYPE DB2/LUW
Specifies the type of data source server to which you are configuring access.
VERSION 11
The version of the Db2 database server that you want to access.
Note: If you used Db2 for z/OS Version 8 to create the database in compatibility mode, you must specify Version 7.
WRAPPER DRDA
The name that you specified in the CREATE WRAPPER statement.
AUTHORIZATION "spalten"
The authorization ID at the data source. This ID must have BINDADD authority at the data source. This value is case sensitive.
PASSWORD "db2guru"
The password that is associated with the authorization ID at the data source. This value is case sensitive.
HOST 'db2dev.ibm.com'
The fully qualified domain name, host name alias, or IP address of the host for the Db2 database that you want to access.
PORT '50000'
The port on which the Db2 database that you want to access is listening.
DBNAME 'CLNTS390'
An alias for the Db2 database that you want to access. This value is case sensitive.

Although the database name variable, host, and port are specified as options in the CREATE SERVER statement, they are all required for Db2 data sources.

Server option example

When you register the server definition, you can specify additional server options in the CREATE SERVER statement. These options include general server options and Db2 data source-specific server options. For more information, see the options reference information.

The CPU_RATIO option indicates how much faster or slower the data source CPU runs than the federated CPU. If you set the CPU_RATIO option to '0.001', this indicates that the CPU at the remote data source has 1000 times more available capacity than the federated server CPU.

For example:
CREATE SERVER DB2SERVER TYPE DB2/LUW VERSION 11 WRAPPER DRDA
  AUTHORIZATION "spalten" PASSWORD "db2guru"
  OPTIONS (HOST 'db2dev.ibm.com', PORT '50000', DBNAME 'CLNTS390', CPU_RATIO '0.001')