On this page
ENV
Switches to an Environment of the current Database Group.
Syntax
ENV <environment>
Quick start
ENV QA;
Opens the QA connection of the current Database Group.
Arguments
| Argument | Required | Values | Default |
|---|---|---|---|
<environment> | Yes | An Environment of the current Database Group | None |
Examples
ENV QA;
CONNECT ENVIRONMENT PROD;Example session
WORLD-QA> ENV PROD;
Disconnected from 'Sample World Database, QA'
Connected to 'WORLD' using JDBC driver 'H2 JDBC Driver, 2.3.232 (2024-08-11)'
Database: H2 version 2.3.232 (2024-08-11)
WORLD>
WORLD> ENV NOPE;
ERROR: Cannot switch to Environment 'NOPE': Environment 'NOPE' does not exist.
Details
How the connection is found
The Environment is looked up in the Database Group of the current connection only. The connection mapped to it in that group is then opened exactly as CONNECT <connection> would open it: same checks, login script and prompt. After ENV QA, the session is the one CONNECT of the QA connection would have produced, and the prompt shows that connection.
CONNECT <name> always means a connection and ENV <name> always means an Environment, so a connection and an Environment with the same name never conflict.
Errors
Other Database Groups are never searched: from a connection without a Database Group, ENV fails. It also fails, leaving the current connection open, when the Environment does not exist, has no connection in the group, is mapped to an inactive connection, or when that connection cannot be opened.
Related
- CONNECT
- SHOW GROUP, the Environments of the current Database Group
- Connections, Database Groups and Environments
Used in these how-tos
- How do I check a figure in QA, then in production, without switching?
- How do I check that a deployment changed a table the same way in QA and production?
- How do I run a post-deployment smoke check on every environment?
- How do I investigate a support ticket and keep the evidence?
- How do I verify that a data fix changed only the intended rows?
Last modified in release 5.5.0.
Found something wrong or unclear on this page? Tell us, with the page address.