<a id="flink-sql-use-catalog-statement"></a>

# USE CATALOG Statement in Confluent Cloud for Apache Flink

Confluent Cloud for Apache Flink® enables setting the active environment with the SQL USE statement.

## Syntax

```sql
USE CATALOG catalog_name;
```

## Description

Set the current catalog (Confluent Cloud environment). All subsequent commands that
don’t specify a catalog use `catalog_name`.

Confluent Cloud for Apache Flink interprets your Confluent Cloud environments as catalogs. Flink can access
various databases (Apache Kafka® clusters) in a catalog.

The `catalog_name` parameter is case-sensitive.

The default current catalog is named `default`.

If `catalog_name` doesn’t exist, Flink throws an exception on the next
DML or DDL statement.

#### IMPORTANT
USE CATALOG is a client-side setting statement and sets corresponding
properties that are attached to future requests.

By itself, a USE CATALOG statement is a no-op. To see its effect, you must
follow it with one or more DML or DDL statements, for example:

```sql
-- Set the current catalog (environment).
USE CATALOG my_env;

-- Set the current database (Kafka cluster).
USE cluster_0;

-- Submit a DDL statement.
SELECT * FROM my_table;
```

Use the [USE DATABASE statement](use-database.md#flink-sql-use-database-statement) to
set the current Flink database (Kafka cluster).

## USE CATALOG in Cloud Console workspaces

When you run the USE CATALOG statement in a Cloud Console workspace,
it sets the catalog used in any subsequent CREATE statement
requests for the specific editor cell. Different cells can use different
catalogs within the same workspace.

The catalog parameter is unquoted, for example, `USE CATALOG catalog1;`.

Any USE statements within an editor cell take precedence over the settings
in the workspace’s global **catalog** and **database** dropdown controls.

In Cloud Console, you can’t run a USE CATALOG statement by itself.
It must be run before other Flink SQL statements, for example:

```sql
USE CATALOG `default`;
SHOW CURRENT CATALOG;
```

<!-- .. admonition:: See **USE CATALOG** in action -->
<!-- The following resources show the USE CATALOG statement in various -->
<!-- applications. -->
<!-- - TODO -->
<!-- - TODO -->
<!-- Example -->
<!-- ======= -->
<!-- In the |flink-sql| shell, run the following commands to see an example of the -->
<!-- USE CATALOG statement. -->
<!-- TODO -->

## Related content

- [USE database](use-database.md#flink-sql-use-database-statement)

#### NOTE
This website includes content developed at the [Apache Software Foundation](https://www.apache.org/)
under the terms of the [Apache License v2](https://www.apache.org/licenses/LICENSE-2.0.html).
