This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.
LinkedIn
Copied!

Table of Contents

Connecting to a Couchbase Server database

You can connect to a Couchbase Server database to perform save and select operations on Pega Diagnostic Cloud (PDC) alert instances without using custom SQL or custom Java. This ability improves horizontal scaling and is useful when you want to use a third-party data and reporting tool to access the data in your database.

Use the following high-level steps to configure and test your Couchbase Server database:

Creating a database instance

Before connecting to the database either from the Pega® Platform or the prconfix.xml file, create a database instance (Data-Admin-DB-Name).

  1. Click +Create > SysAdmin > Database.
  2. Enter a short description.
  3. In the Database field, enter the database name.
  4. Click Create and open.

Connecting to a Couchbase Server database from the Pega Platform

Connect to a Couchbase Server database from the Pega Platform.

  1. On the Database tab, in the How to connect field, click use Couchbase cluster configuration listed below.
  2. In the Hostname or comma separated list field, enter a comma-separated list of host IP addresses.
  3. In the Bucket Name field, enter the name of the bucket used by the Couchbase Server database to save your data.
  4. Optional. In the Bucket Password field, enter the password for accessing the bucket.
  5. In the Couchbase timeout (global) field, enter the length of the time-out in milliseconds.
  6. Click Save.
  7. Click Test connection.

Connecting to a Couchbase Server database by using the prconfig.xml file

Add the following required settings for Data-Admin-DB-Name to the prconfig.xml file, replacing <database name> with the database name configured when you created the database instance.

  • database/databases/<database name>/Hosts – comma-separated list of IP addresses of the host machines
  • database/databases/<database name>/bucket – the name of the bucket to access.
  • database/databases/<database name>/type – the type of database. Set the value to "Couchbase" for a Couchbase Server database.

For example, to connect to a bucket named Pega on a local Couchbase Server database using a 6-second connection time-out, add the following settings to the prconfig.xml file.

<env name="database/databases/CB1/Hosts" value="198.51.100.3,198.51.100.16,198.51.100.21" />
<env name="database/couchbase/connectTimeout" value="6000" />
<env name="database/databases/CB1/bucket" value="Pega" />
<env name="database/databases/CB1/password" value="" />
<env name="database/databases/CB1/type" value="COUCHBASE" />

Reading and writing data using a data type

You can use a data type to add records to a Couchbase bucket to test that you can read and write to the database. Use the following high-level steps to set up the data type:

  • Define the data type
  • Map the data type to a Couchbase bucket
  • Identify the class keys and create the initial data pages

Defining the data type

  1. From the Data Explorer, click Add data type from the dropdown menu at the top right of the explorer.
  2. Enter a label.
  3. Enter a description.
  4. Click Submit. Do not close the data type.

Mapping the data type to a Couchbase bucket

  1. To map your data type to a Couchbase bucket, click +Create > SysAdmin > Database Table.
  2. Enter a short description.
  3. In the Class Name field, select the class name assigned to the data type.
  4. Click Create and Open.
  5. In the Database field, click the Couchbase Server database.
  6. Click Save.
  7. Option. Click Test Connectivity to confirm that you can connect to the Couchbase Server database.

Identifying the class keys and creating the initial data pages

  1. To identify class keys and create the initial data pages, return to the data type you just created.
  2. Click Create a local source.
  3. Click Use as Key in the rows of the fields that are keys.
  4. Click Submit.
  5. Optional. Click the Records tab and add records to add to the Couchbase Bucket.
  6. Click Close.

Related Content

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.