Skip to content
The latest version of DbVisualizer was released 2024-03-11DOWNLOAD HERE ->

Using Variables in Connection Fields

Variables can be used in some of the Connection tab fields. You can use variables in the Name, Userid and Password (both Database and SSH) fields with the Server Info settings format, or in the Database URL field when using this settings format. This can be a useful alternative to having a lot of similar database connection objects. Several variables can be defined in a single field, and default values can be set for each variable. The following figure shows an example with variables, described in more detail in the Using DbVisualizer Variables page.

connectvariables

The following variables appear in the figure:

  • ${Name}$
  • ${Database Host||dbhost2||||choices=[dbhost1,dbhost2,dbhost3]}$
  • ${Port||1521}$
  • ${SID||ORCL}$

All of these variables define a default value after the "||" delimiter, except for the ${Name}$ variable, which has no default value. The default values appear in the connect dialog when you ask for a connection to be established. The ${Database Host}$ variable includes the choices option, with a comma separated list of choices that should appear in a drop-down list. The drop-down list is editable, so the user is not locked into the choices from the list.

The following figure shows the connect dialog based on the connection definition shown above.

connectvariableprompt

Enter the appropriate information in the fields and then press the Connect button to establish the connection. When the connection is established, DbVisualizer automatically substitutes the variables in the Connection tab with the values entered in the connect dialog. At disconnect from the database, they revert back to the original variable definitions.