On this page

ENV

Core command ENVT CONNECT ENVIRONMENT

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

ArgumentRequiredValuesDefault
<environment>YesAn Environment of the current Database GroupNone

Examples

Switches to the QA connection of the current Database Group
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.
Illustrative output: the values come from the WORLD sample and the practice connections of the how-to on QA and production copies of WORLD, and the layout from this release; it was not captured from a BroadSQL run, and your timings will differ.

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.

Used in these how-tos

Last modified in release 5.5.0.

Found something wrong or unclear on this page? , with the page address.