Add an environment
Connect a project to a database: provider, encrypted connection string, tier and test.
In short
An environment is one database a project can run against: a name, a provider (SQL Server, PostgreSQL, MySQL, MariaDB or SQLite), a connection string or an organization connection, a tier and variables. A project usually has a few, such as Local, QA and Production. The connection string is encrypted and never shown again.
Before you start
- Who: connecting databases needs Manage on the project. In an organization only an organization administrator can lower an environment's tier or make it writable.
- Plan: SQL Tester is part of every plan, Free included. Your plan sets your runs, projects and environments (Plan & usage shows them). Production execution and load testing are on the paid plans.
- First: a connection string for a login with the fewest rights the tests need. Give Production a login that can only read.
Add an environment
- Open the environment chip in the title row and choose "Add environment" - or choose "Connections" there and press "New environment".
- Enter a Name. If your organization connected test databases, choose one under "Organization connection" and go to the Tier: it brings its provider and connection string.
- Otherwise choose the Provider (or press "Type a connection string instead"). An example connection string appears under the field.
- Paste the "Connection string". Use a database login with the fewest rights the tests need.
- Choose the "Tier" that matches what the database really is.
- Tick "Read-only" to force every run here to roll back. Tick "Default" if tests without an environment should run here.
- Press "Test connection", then "Save and test".
Protect the connection string
It is a secret Whoever can run in the project can execute SQL as the login in the connection string. Never use a server administrator login, and give Production a login that can only read.
Only the tier is protected Naming an environment Production does nothing; setting its Tier to Production does. Custom has no protection. If a database holds real data, set Preprod, Staging or Production, or tick Read-only.
Do not paste a connection string into a test's SQL or description; those are stored as written.
Good to know
- The server opens every connection, not your browser. A cloud database works once its firewall allows the server's outbound address. A database on a private network the server cannot reach needs the app deployed inside that network.
- The list shows only the host and database name. When you edit an environment, leave the connection string blank to keep the stored one.
- The first environment is the default automatically. A disabled environment refuses every run.
- In an organization, only an organization administrator can lower an environment's tier or make it writable.
- "Test connection" shows the round trip and server version on success.
- An organization connection is added in Organization settings, under Connections, by whoever manages them. Its teams say who may choose it; once chosen, whoever may run in the project runs through it.
- "Connection paused" means the organization paused it: runs wait until it is fixed. "Connection stopped" means it was removed or no longer lets in the person who chose it: edit the environment and choose again.
If something goes wrong
Related
- /help/sql-tester/safety-tiers-and-load-testing
- /help/sql-tester/variables-and-chaining
- /help/sql-tester/start-here