IBM Db2 Event Store ConfigurationReader API guide

This topic covers the main operations that are included in the ConfigurationReader (OLTP) API, such as connecting to IBM® Db2® Event Store. This topic also provides examples written for the Scala client interface and Python client interface.

This guide is written for IBM Db2 Event Store Developer Edition and IBM Db2 Event Store Enterprise Edition users.

Before you begin

Ensure that you are familiar with the limitations and known issues for your IBM Db2 Event Store edition before you develop a client application:

The interface for connecting to IBM Db2 Event Store is exposed as the ConfigurationReader instance.

To use the ConfigurationReader class, you must import the com.ibm.event.common.ConfigurationReader package into your application.

IBM Db2 Event Store Configuration Reader

The configuration reader singleton object defines the following set of methods to establish a connection and provide user ID and password information to IBM Db2 Event Store.

Set connection endpoints

This method provides a single connection endpoint or multiple connection endpoints to IBM Db2 Event Store.
Restriction: You do not need to specify connection endpoints if you are using a notebook. Connection endpoints are required only for remote client applications.
ConfigurationReader.setConnectionEndpoints(connectString: String),
Arguments
connectionString
A string that specifies one or more IBM Db2 endpoints and one or more IBM Db2 Event Store endpoints with the form hostIP:db2port;hostIP:port. Separate each entry on either side of the semicolon with a comma. For more information about connection endpoints, refer to Identifying the connection endpoint of the IBM Db2 Event Store instance
Returns
None
Example
Python
ConfigurationReader.setConnectionEndpoints("<connection endpoint>")
Scala
ConfigurationReader.setConnectionEndpoints("<connection endpoint>")

Set front-end connection endpoints

This method specifies front-end connection endpoints that you can use instead of the connection endpoints that are stored in IBM Db2 Event Store.

For example, if you use network address translation, you might need to use front-end connection endpoints if the connection endpoints that are specified by the front end would resolve to different connection endpoints than those stored in IBM Db2 Event Store.

You must set the connection endpoints before you set front-end connection endpoints.

ConfigurationReader.setUseFrontendConnectionEndpoints(useFrontendConnectionEP: Boolean)
Arguments
useFrontendConnectionEP
Specify true to use front-end connection endpoints.

Specify false to use the connection endpoints set by the setConnectionEndpoints method. This is the default value.

Returns
None
Example
Python
from eventstore.common import ConfigurationReader
ConfigurationReader.setUseFrontendConnectionEndpoints(true)
Scala
import com.ibm.event.common.ConfigurationReader
ConfigurationReader.setUseFrontendConnectionEndpoints(true)

Set the table schema name

This method specifies the IBM Db2 table schema name the user wants to default to.

def setEventSchemaName(name: String)
Arguments
name
IBM Db2 table schema name the user wants to default to.
Returns
None
Example
Python
ConfigurationReader.setEventSchemaName("USER")
Scala
ConfigurationReader.setEventSchemaName("USER")

Specify a Db2 user ID

This method specifies the user ID that is used to connect to IBM Db2.

ConfigurationReader.setEventUser(userString: String)
Arguments
userString
A user ID that is registered in IBM Db2.
Returns
None.
Example
Python
ConfigurationReader.setEventUser("user")
Scala
ConfigurationReader.setEventUser("user")

Specify a password

This method specifies the password that is used to connect to IBM Db2.
ConfigurationReader.setEventPassword(passwordString: String)
Arguments
passwordString
The password that is associated with the specified Db2 user ID.
Returns
None
Example
Python
ConfigurationReader.setEventPassword("passwd")
Scala
ConfigurationReader.setEventPassword("passwd")

Set the client application timeout

This method specifies the maximum time to wait for a request to IBM Db2 Event Store from a client application that is calling the OLTP APIs or the OLAP APIs.

ConfigurationReader.setConnectionTimeout(connTimeout: Int)
You can set this value only once per application. The value that you specify is used throughout the application. However, this can be an issue if your application performs both asynchronous insert and query operations. This is because different timeouts are recommended for each action:
  • Typically, a shorter timeout is recommended for asynchronous insert operations. This is because the asynchronous insert API automatically attempts to resolve errors that are caused by communication issues or node failures, and you can improve the performance of your application by setting a low value for the timeout.
  • Conversely, if you have a long-running query against a large data set, your application might timeout before the results of the query are returned, and you can improve the performance of your application by setting a high value for the timeout.
You can resolve this issue in several ways:
  • You can try to find a balance between the timeout required for performance during insert and queries.
  • You can develop separate applications for inserting data and querying data.
Arguments
connTimeout
The maximum number of seconds that the client can wait for a response from IBM Db2 Event Store.

The default value is 120 seconds. The minimum value is 1 second.

Returns
None
Example
Python
ConfigurationReader.setConnectionTimeout(120)
Scala
ConfigurationReader.setConnectionTimeout(120)

Set the truststore file location for SSL connections

This method specifies the truststore file location for SSL connections.

ConfigurationReader.setSslTrustStoreLocation(location : String)
Arguments
location
The location of the file that stores certificates from trusted Certificate Authorities.
Returns
None
Example
Python
ConfigurationReader.setSslTrustStoreLocation("/user-home/_global_/security/customer-truststores/cacerts")
Scala
ConfigurationReader.setSslTrustStoreLocation("/user-home/_global_/security/customer-truststores/cacerts")

Set the truststore password for SSL connections

This method specifies the truststore password for SSL connections

ConfigurationReader.setSslTrustStorePassword(password: String)
Arguments
password
The password for the file that stores certificates from trusted Certificate Authorities.
Returns
None
Example
Python
ConfigurationReader.setSslTrustStorePassword("passwd")
Scala
ConfigurationReader.setSslTrustStorePassword("passwd")

Set the keystore file location for SSL connections

This method specifies the keystore file location for SSL connections.

ConfigurationReader.setSslKeyStoreLocation(location : String)
Arguments
location
The location of the keystore file.
Returns
None
Example
Python
ConfigurationReader.setSslKeyStoreLocation("/user-home/_global_/security/customer-truststores/cacerts")
Scala
ConfigurationReader.setSslKeyStoreLocation("/user-home/_global_/security/customer-truststores/cacerts")

Set the keystore password for SSL connections

This method specifies the keystore password for SSL connections

ConfigurationReader.setSslKeyStorePassword(password: String)
Arguments
password
The password for the keystore file.
Returns
None
Example
Python
ConfigurationReader.setSslKeyStorePassword("passwd")
Scala
ConfigurationReader.setSslKeyStorePassword("passwd")

Set the plugin name for SSL connections

This method specifies the plugin name for SSL connections

ConfigurationReader.setClientPluginName(pluginName: String)
Arguments
pluginName
The plugin name for SSL connections.
Returns
None
Example
Python
ConfigurationReader.setClientPluginName("IBMIAMauth")
Scala
ConfigurationReader.setClientPluginName("IBMIAMauth")

Specify if a plugin name is input for SSL connections

This method specifies if a plugin name is input for SSL connections.

ConfigurationReader.setClientPlugin(plugin: Boolean)
Arguments
plugin
Denotes if a plugin name has been input.
Returns
None
Example
Python
ConfigurationReader.setClientPlugin(True)
Scala
ConfigurationReader.setClientPlugin(True)

Specify if SSL is enabled

This method specifies if SSL is enabled.

ConfigurationReader.setSSLEnabled(isEnabled: boolean)
Arguments
isEnabled
Denotes if SSL has been enabled.
Returns
None
Example
Python
ConfigurationReader.setSSLEnabled(True)
Scala
ConfigurationReader.setSSLEnabled(True)

Set the deployment ID in an IBM Cloud Pak for Data environment

This method specifies the target IBM Db2 Event Store deployment in a IBM Cloud Pak for Data environment. It will configure the SSL connection to the target Db2 Event Store deployment.
Note: This API is only valid when called from a Jupyter notebook in the IBM Watson™ Studio project that is created on the same IBM Cloud Pak for Data cluster where the target Db2 Event Store is deployed.
ConfigurationReader.setDeploymentID(DeploymentID: String)
Arguments
DeploymentID
The deployment ID of the target Db2 Event Store deployment. For more information on finding the deployment ID, refer to Identifying the deployment ID of Db2 Event Store in a IBM Cloud Pak for Data deployment.
Returns
None
Example
Python
ConfigurationReader.setDeploymentID("db2eventstore-1579803671450")
Scala
ConfigurationReader.setDeploymentID("db2eventstore-1579803671450")