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:
- Create a database instance
- Connect to the database either from the Pega Platform or using the prconfig.xml file
- Optionally, use a data type to add records to a Couchbase Bucket to ensure that you can read and write to the 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).
- Click +Create > SysAdmin > Database.
- Enter a short description.
- In the Database field, enter the database name.
- Click Create and open.
Connecting to a Couchbase Server database from the Pega Platform
Connect to a Couchbase Server database from the Pega Platform.
- On the Database tab, in the How to connect field, click use Couchbase cluster configuration listed below.
- In the Hostname or comma separated list field, enter a comma-separated list of host IP addresses.
- In the Bucket Name field, enter the name of the bucket used by the Couchbase Server database to save your data.
- Optional. In the Bucket Password field, enter the password for accessing the bucket.
- In the Couchbase timeout (global) field, enter the length of the time-out in milliseconds.
- Click Save.
- 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 machinesdatabase/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
- From the Data Explorer, click Add data type from the dropdown menu at the top right of the explorer.
- Enter a label.
- Enter a description.
- Click Submit. Do not close the data type.
Mapping the data type to a Couchbase bucket
- To map your data type to a Couchbase bucket, click +Create > SysAdmin > Database Table.
- Enter a short description.
- In the Class Name field, select the class name assigned to the data type.
- Click Create and Open.
- In the Database field, click the Couchbase Server database.
- Click Save.
- 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
- To identify class keys and create the initial data pages, return to the data type you just created.
- Click Create a local source.
- Click Use as Key in the rows of the fields that are keys.
- Click Submit.
- Optional. Click the Records tab and add records to add to the Couchbase Bucket.
- Click Close.
Previous topic Couchbase Server support Next topic Declare Index rules