Registering the server definitions for a document store data source
You must register each document store data source server that you want to access in the federated database.
Procedure
- Locate the server name of your document store data source server.
- To create the server, issue the CREATE SERVER statement
from the command line.
CREATE SERVER <server_definition_name> TYPE <server_type> VERSION <version_number> WRAPPER <wrapper_name> OPTIONS (HOST '<host_name>', PORT '<port_number>', DBNAME '<database_name>', SSL_TRUSTSTORE '<ssl_truststore>', SSL_TRUSTSTORE_PASSWORD '<ssl_truststore_password>', SSL_KEYSTORE '<ssl_keystore>', SSL_KEYSTORE_PASSWORD '<ssl_keystore_password>');- Parameter values
-
- TYPE 'server_type'
- Specifies the type of data source server to which you are configuring access. Currently it
supports 2 types of document data sources listed in table 1 as below:
Table 1. Server types for document store data sources Document store data source <server_type> MongoDB MONGODBREST1, MONGODRIVER2, RESTHEART3 CouchDB COUCHDB 1If the server type is MONGODBREST, RESTAPI is used to connect to MongoDB. The MONGODBREST option depends on an HTTP interface being configured correctly and running on MongoDB version 3.4, and earlier versions have a built-in HTTP interface.
2If the server type is MONGODRIVER, the native MongoDB driver is used to connect to MongoDB. This approach has less dependency compared to other approaches and provide more performance advantages since this method leverages MongoDB full native API.
3If the server type is RESTHEART, RESTAPI is used to get data. However RestHeart is a third-party tool that must be installed separately. RestHeart supports more features than the MongoDB HTTP interface, and provides better performance than method 1 because it supports more filter functionality.
- VERSION 'version_number'
- The version of the document store database server that you want to access.
- WRAPPER 'wrapper_name'
- The wrapper name that you specified in the CREATE WRAPPER statement.
- HOST 'host_name'
- The server name where the document store database server resides. User can specify the IP
address as the hostname. A semicolon separated value like
srvname1:port1;srvname2:port2;srvname3:port3is supported if the server_type is MONGODRIVER and the remote data source is a MongoDB replica set. The port numbers here are optional, and the value of PORT parameter is used when port numbers are not specified. - PORT 'port_number'
- The server listening port.
- DBNAME 'database_name'
- The value of this option is not used, but it is also a mandatory option during the CREATE SERVER operation.
- SSL_TRUSTSTORE 'ssl_truststore'
- Optional: Specifies the truststore file path if server-side Transport Layer Security (TLS) certificate is enabled. PKCS12 and JKS file formats compatible with IBM JDK are supported. The SSL_TRUSTSTORE parameter is only valid when server_type is MONGODRIVER.
- SSL_TRUSTSTORE_PASSWORD 'ssl_truststore_password'
- The password for the truststore file. This parameter is required if SSL_TRUSTSTORE is specified.
- SSL_KEYSTORE 'ssl_keystore'
- Optional: Specifies the keystore file path if client-side TLS certificate is required. PKCS12 and JKS file formats compatible with IBM JDK are supported. The SSL_KEYSTORE parameter is only valid when server_type is MONGODRIVER and SSL_TRUSTSTORE is specified.
- SSL_KEYSTORE_PASSWORD 'ssl_keystore_password'
- The password for the keystore file. It is required if SSL_KEYSTORE is specified.
CREATE SERVER mongo_server TYPE MONGODBREST VERSION 3.5 WRAPPER my_wrapper OPTIONS (HOST ‘host_name’, PORT ‘port_number’, DBNAME ‘database_name’);