Apicat Docs
  1. Database operations
Apicat Docs
  • What is Apicat?
  • Send requests
    • Create requests
      • Request basics
      • Parameters and body
      • Request headers
      • Request settings
      • Dynamic values
      • HTTP/2
      • SOAP/WebService
    • Authentication and authorization
      • Overview
      • CA and client certificates
      • Authorization types supported by Apidog
      • Digest Auth
      • OAuth 1.0
      • OAuth 2.0
      • Hawk Authentication
      • Kerberos
      • NTLM
      • Akamai EdgeGrid
    • Response and cookies
      • Overview
      • API response in Apidog
      • Create and send cookies
      • Debug requests
    • Dynamic values Modules
      • Airline
      • Animal
      • Color
      • Commerce
      • Company
      • Database
      • Datatype
      • Date
      • Finance
      • Food
      • Git
      • Hacker
      • Helpers
      • Image
      • Internet
      • Location
      • Lorem
      • Music
      • Number
      • Person
      • Phone
      • Science
      • String
      • System
      • Vehicle
      • Word
  • Environments & variables
    • Overview
    • Using variables
    • Environments & services
  • Pre/Post processors
    • Overview
    • Assertion
    • Extract variable
    • Wait
    • Database operations
      • Overview
      • MySQL
      • MongoDB
      • Redis
      • Oracle Client
    • Using scripts
      • Overview
      • Pre processor scripts
      • Post processor scripts
      • Public scripts
      • Postman scripts reference
      • Calling other programming languages
      • Using JS libraries
      • Visualizing responses
      • Script examples
        • Assertion scripts
        • Using variables in scripts
        • Using scripts to modify request messages
        • Other examples
  • Best practices
    • How to handle API signatures
    • How to access OAuth 2.0 protected APIs
    • Apidog collaboration workflow
    • Managing authentication state in Apidog
  • Account & preferences
    • Account settings
    • Generate OpenAPI access token
    • Language settings
    • Hot keys
    • Network proxy configuration
    • Data backup
    • Updating Apidog
    • Deleting account
    • Experimental Features
  • References
    • API-Design First Approach
    • Apidog OpenAPI/Swagger Specificaiton Extensions
    • JSONPath
    • XPath
    • Regular Expressions
    • JSON Schema
    • CSV File Format
    • Install Java Environment
    • Runner deployment environment
    • Apidog flavored Markdown
  1. Database operations

Database Operations in Apidog

Pre/post processors support adding databases. After selecting and connecting to a database, you can perform CRUD and more on the data tables. The results of these operations can be printed in the console or extracted as variables. These variables can then be used in various scenarios, such as parameters for other endpoint requests, assertions, custom scripts, and interacting with other databases.

Getting started#

Here are the steps to use database operations.
1
In the Run tab (Design-first Mode) or the Request tab (Request-first mode), navigate to Post Processors.
Design-first Mode
Request-first Mode
image.png
2
Hover over "Add PostProcessor" and select "Database operation".
3
Name the database operation and select a database connection.
4
Enter the SQL command. The command supports using {{variables}} within it.
For example, you can use SQL like this:
5
You have the option to extract the results of the SELECT query as variables. Set "Extract Result To Variable". JSONPath is supported.
The SELECT statement retrieves an array of results where each row represents an element in the array. For example, using the JSONPath $[0].uid would extract the value of the "uid" field from the first row of the results.
6
Click Send to execute the request. You can view the database operation's results in the Console.
Apidog supports standard SQL queries but does not accommodate complex SQL operations like stored procedures.

Database connections#

Apidog Free supports connections to the following types of databases:
MySQL
SQLServer(Supports versions above SQL Server 2014)
Oracle
PostgreSQL
After upgrading to the paid version, Apidog also supports connectivity to the following databases in addition:
Clickhouse
MongoDB
Redis
Connecting to an Oracle database in Apidog requires installing the Oracle Client separately.
To set up a database connection in Apidog, follow the steps:
1
Navigate to Settings - Database Connections.
image.png
2
Click on "New" at the top right to create a new database connection entry.
3
Choose the database type from the available options and provide the necessary connection details for the database, such as host, port, database name, username, and password.
4
Besides connecting to a database locally with a username and password, you can establish a more secure connection through an SSH tunnel for added protection of the data being transmitted.
5
Click Save,and you'll be able to select this connection in Post processors.
Apidog values your data security. Database address, port, username, password, and database name are only stored on the client side locally and are not synced to the cloud. Even within the same team, members do not sync their database connection information with each other, and each team member needs to manually set up their database.
MySQL Tips
Currently, the latest mysql modules do not fully support the caching_sha2_password encryption method of MySQL8, where caching_sha2_password is the default encryption method.
Please use the method that requires you to specify the mysql_native_password mode to change the MySQL account password, use another tool to connect to MySQL, and then run the following SQL to change the password of the corresponding account.
Please replace username and password above manually.

Using database operations in multiple environments#

When working with multiple environments such as testing and production environments, they often have different databases configured. If you are using database operations in your workflows, it implies that these operations need to switch along with the environment changes.
In such scenarios, you can configure multiple database connections under the "Database Connections" settings in Apidog. By setting up database connections for each environment, you can ensure that when switching between environments using the dropdown menu in the top right corner, the database queries will automatically be directed to the corresponding database connection associated with that environment.

Using NoSQL databases#

For operations on MongoDB, refer to MongoDB operations.
For operations on Redis, refer to Redis operations.

Using database operations in Apidog CLI#

Apidog supports executing test scenarios on any platform using the Command Line Interface (CLI). By utilizing the CLI, you can fetch test scenario configurations from the server in real-time and run them efficiently.
However, since database operations are locally stored, it means that the CLI cannot dynamically access your database configurations.
In such cases, you need to export your database operations as configuration files and place them on the machine where the CLI is being run. Learn more about Apidog CLI.

FAQ#

Q: Can I combine multiple SQL queries into a single database operation in Apidog?
A: Each database operation in Apidog can only execute one SQL query. If you have multiple SQL queries to run, they need to be divided into separate database operations for execution.
Modified at 2025-06-25 07:57:16
Previous
Wait
Next
MySQL
Built with