Apidog Docs
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
HomeLearning CenterSupport CenterAPI References
HomeLearning CenterSupport CenterAPI References
Discord Community
Slack Community
X / Twitter
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
  1. Project Resources
  • Apidog Learning Center
  • Get started
    • Introduce Apidog
    • Basic concepts in Apidog
    • Navigating Apidog
    • Quick Start
      • Overview
      • Specify a new endpoint
      • Make a request to the endpoint
      • Add an assertion
      • Create a test scenario
      • Share your API documentation
      • Explore more
      • Send a request and save as an endpoint
    • Migration
      • Overview
      • Manual import
      • Scheduled import
      • Import options
      • Export data
      • Import from...
        • Import from Postman
        • Import OpenAPI (Swagger) spec
        • Import cURL
        • Import Markdowns
        • Import from Insomnia
        • Import from apiDoc
        • Import .har file
        • Import WSDL
  • Design APIs
    • Overview
    • Create a new API project
    • Endpoint basics
    • Components
    • Common fields
    • Global parameters
    • Endpoint change history
    • Batch endpoint management
    • Configure multiple request body examples
    • Schemas
      • Generate Schemas from JSON etc.
      • Build a schema
      • Overview
      • Create a new schema
    • Security schemes
      • Overview
      • Create a security scheme
      • Use the security scheme
      • Security scheme in online documentation
    • Advanced features
      • Custom endpoint fields
      • Import endpoints as test steps
      • Endpoint status
      • Appearance of parameter lists
      • Endpoint unique idenfication
  • Develop and Debug APIs
    • Overview
    • Generate requests
    • Send requests
    • Endpoint cases
    • Dynamic values
    • Validate responses
    • Design-first Mode & Request-first Mode
    • Generate code
    • Environments & variables
      • Overview
      • Using variables
      • Environments & services
    • Vault secrets
      • Overview
      • HashiCorp Vault
      • Azure Key Vault
      • AWS Secrets Manager
    • Pre/Post processors
      • Overview
      • Assertion
      • Extract variable
      • Wait
      • Database operations
        • Overview
        • MongoDB
        • Redis
        • Oracle Client
      • Using scripts
        • Overview
        • Postman scripts reference
        • Pre processor scripts
        • Post processor scripts
        • Public scripts
        • 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
    • Dynamic values Modules
  • Mock API data
    • Overview
    • Smart mock
    • Custom mock
    • Mock priority sequence
    • Mock scripts
    • Cloud mock
    • Self-hosted runner mock
    • Mock language (Locales)
  • Automated tests
    • Overview
    • Test reports
    • Test scenarios
      • Create a test scenario
      • Pass data between requests
      • Flow control conditions
      • Import endpoints/endpoint cases from other projects
      • Sync data from endpoints/endpoint cases
      • Export test scenarios
    • Run test scenarios
      • Run a test scenario
      • Data-driven testing
      • Run test scenarios in batch
      • Scheduled tasks
      • Manage the runtime environment of APIs from other projects
    • Test APIs
      • Integration testing
      • Performance testing
      • End-to-end testing
      • Regression testing
    • Apidog CLI
      • Overview
      • Installing and running Apidog CLI
      • Apidog CLI Options
    • CI/CD
      • Overview
      • Integrate with Jenkins
      • Integration with Gitlab
  • Publish API Docs
    • Overview
    • API Technologies Supported
    • Quick share
    • View the API documentation
    • Publish docs sites
    • Folder tree settings
    • Custom layouts
    • Visibility settings
    • Endpoint SEO settings
    • Custom domain
    • Embedding values in document URLs
    • Documentation Search
    • Integrating Google Analytics with Doc Sites
    • CORS Proxy
    • API Versions
      • Overview
      • Create API versions
      • Publish API versions
      • Share endpoints with API versions
  • Send requests
    • Overview
    • gRPC
    • Use request proxy agents for debugging
    • SOAP/WebService
    • GraphQL
    • WebSocket
    • Socket.IO
    • SSE debugging
    • Create requests
      • Request History
      • Request basics
      • Parameters and body
      • Request headers
      • Request settings
      • HTTP/2
    • 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
      • Save the request as an endpoint
  • Branches
    • Overview
    • Create a new sprint branch
    • Test APIs in a branch
    • Design API in a branch
    • Merge sprint branches
    • Manage sprint branches
  • Apidog MCP Server
    • Overview
    • Conntect API Specification within Apidog Project to AI via Apidog MCP Server
    • Conntect Online API Documentation Published by Apidog to AI via Apidog MCP Server
    • Conntect OpenAPI Files to AI via Apidog MCP Server
  • Best practices
    • How to handle API signatures
    • How to access OAuth 2.0 protected APIs
    • Apidog collaboration workflow
    • Managing authentication state in Apidog
  • Administration
    • Onboarding Checklist
      • Basic Concepts
      • Onboarding Guide
    • Managing Teams
      • Managing Teams
      • Managing Team Members
      • Member Roles & Permission Settings
      • Team Activities
      • Team Resources
        • General Runner
        • Team Variables
        • Request Proxy Agent
      • Real-time Collaborations
        • Team Collaboration
    • Managing Projects
      • Managing Projects
      • Managing Project Members
      • Notification Settings
      • Project Resources
        • Database Connection
    • Managing Organizations
      • Single Sign-On (SSO)
        • SSO Overview
        • Configure Microsoft Entra ID
        • Configure Okta
        • Configure SSO for an Organization
        • Managing user accounts
        • Mapping Groups to Teams
      • SCIM Provisioning
        • Intro to SCIM Provisioning
        • Microsoft Entra ID
        • Okta
      • Organization Resources
        • Self-hosted Runner
  • Billing
    • Overview
    • Credits
    • Unable to use credit cards?
    • Managing subscriptions
    • Upgrade plan
  • Add-ons
    • API Hub
    • Apidog Intellij IDEA plugin
    • Browser Extension
      • Chrome
      • Microsoft Edge
    • Request Proxy
      • Request proxy in Apidog web
      • Request proxy in shared docs
      • Request proxy in Apidog client
  • Account & preferences
    • Language settings
    • Data backup
    • Network proxy configuration
    • Hot keys
    • Updating Apidog
    • Generate OpenAPI access token
    • Deleting account
    • Account settings
  • 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
  • Apidog Europe
    • Apidog Europe
  • Support Center
  1. Project Resources

Database Connection

You can configure database connection details in the project settings. Once configured, you can use these connections during endpoint debugging and testing by adding database operations in the pre/post processors steps. This allows you to read from or write to the database seamlessly.
database-connection-settings.png
The free version of Apidog supports connecting to the following databases:
MySQL
SQL Server: Supports SQL Server 2014 and later versions
Oracle (Connecting to an Oracle database requires installing Oracle Client)
Db2
PostgreSQL
With an upgrade, you can also connect to:
ClickHouse (Requires Basic plan)
MongoDB (Requires Basic plan)
Redis (Requires Basic plan)

Configuring Database Connection#

Follow these steps to set up a database connection in Apidog:
1
Open Project Settings->Database Connections.
project-database-connection-settings.png
2
Click + New at the top right corner to create a database connection.
3
Select the database type from the available options, fill in the necessary connection information such as host, port, database name, user name, and password. It is recommended to use variables to fill in. Database connections filled entirely with variables can be saved in the cloud for collaboration.
📌
Important! When using variables for database connections, be mindful of data security implications.
database-connection-details.png
4
In addition to the local connection method using username and password, you can also establish a more secure connection through SSH tunnel to better protect data transmission.
database-connection-via-ssh.png
5
Click Save, and this connection can be used in pre/post processors.

Using Database Connection#

You can add "Database Operations" in pre/post processors for an endpoint request to reference a database connection. After adding it, you can specify a database connection in "Database Operations".
database-connection-pre-post-processors.png
Below are the specific steps for database operations.
1
In theRuntab (Design Mode) orRequesttab (Request Mode), navigate to pre/post processors.
2
Hover over Add PreProcessor orAdd PostProcessor and select Database Operation.
adding-database-operation.png
3
Name the database operation and configure the database connection. Ensure the selected "Database Connection" is correctly set up. Learn More.
configuring databse connection.png
4
Enter the SQL command. Variables such as {{variables}} are supported in commands.
5
EnableExtract Result To Variable(supports JSONPath) and toggle Console Logif needed.
6
Click Send to execute the endpoint request, and check the result in the console.
image.png
If you useDatabase Operationin automated tests—either as a test step or in the pre/post-processors of endpoint requests—you can follow the same steps outlined above to set it up and use it.
Apidog supports standard SQL queries but does not support complex SQL operations such as stored procedures.

Important Notes#

Before executing database operations via requests, ensure the configured database connection is properly saved:
If your database connection uses variables and is stored in the cloud, make sure to set the actual database details (like host, username, password, etc.) in the Current Value field of the related variables. Alternatively, you can use the set variable method to configure these values dynamically.
configuring-variables-current-value.png
If the database connection uses fixed text and is stored locally, you need to enter the actual database details (like host, username, password, etc.) in Project Settings -> Database Connection.
entering-database-connection-credentials.png
If you need to run test scenarios with a database connection via CLI, click here for detailed notes
If you need to run test scenarios with a database connection via Runner, click here for detailed notes.

Storage Mechanism and Data Security#

Currently, Apidog offers two ways to store database connections:
Stored in Apidog Cloud: If the database connection is configured entirely using variables, it will be stored as variables on Apidog’s cloud server.
Stored Locally: If the database connection is configured using fixed text, it will be stored as plain text in the local configuration file.

Differences between Storage Mechanisms#

Storage MechanismStorage MethodAdvantagesDisadvantages
CloudUse variables in configuration1. Enables more convenient collaboration with team members.
2. When running test scenarios via CI, Runner, etc., you can use variables to set the database connection details instead of maintaining local files.
⚠️ When plaintext is used in the initial values of variables, data such as database names and passwords will be transmitted in plaintext to Apidog's cloud servers, posing a data security risk (using current values for variables keeps the data stored locally, eliminating this risk). It is recommended to use vault variables to avoid data security risks.
LocalUse fixed text in configurationLocally stored with no security risk1. Poor collaboration; each team member must configure the database connection individually.
2. When running test scenarios through CI, Runner, or similar tools, you need to maintain a dedicated local file for database connections.
💡
To balance a great user experience with data security, Apidog recommends saving database connections in the cloud and using Vault variables to ensure data safety. It is strongly discouraged to use plaintext in the initial values of variables related to database connections, as this can lead to significant data security risks.
Modified at 2025-03-20 10:32:39
Previous
Notification Settings
Next
SSO Overview
Built with