Selecting Database Connection, Catalog and Schema
You use the Database Connection and Database (or Catalog) lists above the editor to specify which connection and database to use when executing the SQL in the SQL Commander. The list of connections shows all connections as they are ordered in the Databases tab tree, except that all currently active connections are listed first.
If you check the Sticky box above the Database Connection, the current connection selection will not change automatically when passing SQL statements from other parts of DbVisualizer, for instance, when opening a Bookmark. Consider an Bookmark defined for database connection ProdDB
. If the Sticky checkbox is not checked (i.e., disabled), the database connection is automatically changed to ProdDB
when you open the Bookmark in the SQL Editor. However, if the Sticky checkbox is checked (i.e., enabled), the current database connection setting is unchanged. You can specify if you want to have Sticky enabled by default in the Tool Properties dialog, in the SQL Commander category under the General tab.
The Database list (or Catalog) defines which catalog in the connection is the target for the execution. Since not all databases use catalogs, this list may be disabled.
For most databases, the schema selected in the Schema list is used only to limit the tables the Auto Completion feature shows in the completion pop-up; it does not define a default schema for tables referenced in the SQL, because most databases do not allow the default schema to be changed during a session.
For the databases that do allow the default schema to be changed, however, the selected schema is also used as the default schema, i.e., the schema used for unqualified table names in the SQL. Currently, the databases that support setting a default schema are DB2 LUW, DB2 z/OS, DB2 iSeries, H2, JavaDB/Derby, Oracle, NuoDB, PostgreSQL, and Vertica. If the Database Type is set to Generic for a connection, DbVisualizer tries to set the default schema (if Use Schema is chosen) but it depends on the JDBC driver if this works or not.
If you don't want the selected schema to be used as the default schema for these database, you can disable this behavior in the Properties tab for the connection, in the SQL Commander category.
Configuring the Initial Values
When a new Database Connection is selected, the initial values for the Database and Schema lists are by default based on the default values for the connection. You can change this behavior in the Properties tab for the connection, in the SQL Commander category. The initial value for each list that is applicable for the database type can be set to one of The Connection Default, None or The Most Recently Used.