Registering server definitions for JDBC data sources

You must register each JDBC server that you want to access in the federated database.

About this task

For Db2® v11.5.7 or earlier, to register the JDBC server, you must specify the JDBC driver package name from the JDBC driver library and the JDBC connection string of the remote server. As of Db2 v11.5.8, JDBC wrapper need not be created explicitly, and only the URL must be specified. Also, the DRIVER_PACKAGE and DRIVER_CLASS are not required for the JDBC data sources with the driver library bundled in Db2 installation. You can check for the new configuration file jdbc.ini in all the bundled JDBC data sources. For those data sources that are not bundled with the driver library, you can download the JDBC driver from the vendor and specify the DRIVER_PACKAGE and DRIVER_CLASS.

Procedure

Run the CREATE SERVER statement from the command line for every JDBC server that you want to register,
For example:
-- New simplifed syntax
CREATE SERVER server_Definition_Name 
  TYPE jdbc_Datasource_Type 
  VERSION version_Number 
  OPTIONS (
  URLjdbc_Url_Connect_String');       
-- Old traditional syntax
CREATE SERVER server_Definition_Name 
  TYPE jdbc_Datasource_Type 
  VERSION version_Number 
  WRAPPER jdbc_Wrapper_Name 
  OPTIONS (
      DRIVER_PACKAGE 'jdbc_Driver_package_optional',
      DRIVER_CLASSjdbc_Driver_Class_Path', 
      URLjdbc_Url_Connect_String');
Important: When you run the CREATE SERVER statement, it does not create a connection to data source until you run the CREATE NICKNAME statement. If you specify incorrect connection information in the OPTIONS parameter, you are not notified of the error until you run either the CREATE NICKNAME or pass-through statements.

What to do next

After you complete this task, you must create a user mapping.