CXone Studio DBConnector action returning empty result set despite correct SQL

Status: Success
Rows Returned: 0

The DBConnector action in my CXone Studio script executes without error, yet the result set is empty. I have verified the SQL query directly against the database and it returns one row. The connection string uses the standard JDBC format for PostgreSQL.

  1. Is there a specific timeout configuration for the DBConnector that might truncate results?
  2. Could the parameter binding in the Studio action be failing silently?

My payload looks like this:

{"query": "SELECT * FROM users WHERE id = ?", "params": ["123"]}

Have you tried validating the exact JDBC URL parameters and the SQL dialect compatibility layer within the Studio runtime?

The DBConnector action in my CXone Studio script executes without error, yet the result set is empty. I have verified the SQL query directly against the database and it returns one row.

The discrepancy usually stems from how the Studio runtime parses the result set metadata versus what your local client expects. The DBConnector does not expose a raw timeout configuration in the UI, but it enforces a strict 30-second execution window per transaction. If your query involves complex joins or subqueries, it might be timing out silently, returning an empty set rather than an error code.

Check your jdbc:postgresql://... connection string. Ensure you are explicitly setting sslmode=require if your DB requires it, and verify that the currentSchema parameter is correctly set if your table isn’t in the public schema. I faced a similar issue where the SDK defaulted to the public schema, ignoring my qualified table names.

Furthermore, inspect the SQL query for case sensitivity. PostgreSQL folds unquoted identifiers to lowercase, but Studio’s SQL parser might be treating them as case-sensitive depending on the driver version. Try wrapping your table and column names in double quotes: "MyTable".

Here is a minimal test query to isolate the issue:

SELECT COUNT(*) AS row_count FROM "YourSchema"."YourTable" WHERE "id" = ${contact.attributes.test_id}

If this returns 0 in Studio but 1 locally, the issue is likely schema qualification or identifier casing. Also, ensure the resultVariable in the Studio action is mapped to a type that can hold the expected data structure. If you map a complex object to a simple string variable, the SDK might drop the payload.

Ah, yeah, this is a known issue. The DBConnector often fails if the JSON payload structure mismatches the expected schema. Verify your input mapping.

  1. Check the connection string format.
  2. Ensure the SQL query is parameterized correctly.
{
 "sql": "SELECT * FROM users WHERE id = ?",
 "params": [123]
}

You need to verify that your SQL query returns column names that match the expected schema exactly, as the DBConnector relies on strict metadata mapping. The suggestion above regarding parameterization is valid, but often overlooked is the case sensitivity of column aliases in PostgreSQL versus the Studio runtime.

If your query returns user_id but the Data Action expects UserId, the result set will be empty despite a successful SQL execution.

{
 "sql": "SELECT id AS UserId, name AS UserName FROM users WHERE id = ?",
 "params": [123]
}

This explicit aliasing ensures the JSON output structure aligns with the Studio variable definitions. See the documentation on Data Action Result Mapping for details on schema validation. I have encountered this frequently when migrating from legacy SQL scripts to Studio actions. Ensure your connection pool settings are not dropping idle connections prematurely, which can also cause silent failures.