You are here: Pega Platform database > Database administration and performance > Testing SQL queries > Configuring read-only database access

Configuring read-only database access

For query results to be returned when testing queries on the Query Runner landing page, you must have configured read-only user credentials for the database. Use the following procedure for configuring read-only user credentials for PegaRULES and PegaDATA databases. If you are using an external database, see Accessing database administration operations on the PDN, for configuration details.

  1. In the context.xml file, add the following resource for accessing the database:

    <Resource name="jdbc/PegaRULESReadOnly"

    auth="Container"

    type="javax.sql.DataSource"

    maxActive="20"

    maxIdle="10"

    maxWait="-1"

    driverClassName="org.postgresql.Driver"

    url="jdbc:postgresql://<ip address>:<port>/postgres"

    username="<user name>"

    password="<password>" />

    Note: You can also add the user name and password for the read-only user to the prconfig.xml file instead of the context.xml file.

  2. In the prconfig.xml file, add the following data sources. The value must match the resource name in the context.xml file.

    <env name=database/databases/PegaRULES/datasourceReadOnly" value="java:comp/env/jdbc/PegaRULESReadOnly"/>

    <env name=database/databases/PegaDATA/datasourceReadOnly" value="java:comp/env/jdbc/PegaRULES"/>