# Manage database connections in a notebook

This article explains how to manage database connections attached to a notebook.

> **Note:**
> As opposed to managing database connections in a workspace on the Home page, you perform these procedures in the editor when working on a selected notebook.

Procedure: Access attached database connections

Use the Attached data tool from the left-hand sidebar of the editor to access and manage attached data sources. All further procedures are performed from here.

1. In the sidebar, select ![Attach](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/attach.svg) (Attached data).

2. Switch to the Databases tab.

On this tab, you can see all database connections from the respective workspace that are either already attached to the notebook or available for attachment. When attached, a database connection can be used as a data source for this particular notebook.

![Databases tab](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/db_nb.png)

Procedure: Attach a database connection from the workspace

1. In the Attached data tool, switch to the Databases tab.

2. To attach or detach a database connection to the notebook, use the toggle for the respective item on the list. The off position of the toggle indicates the database is detached, meaning it is not accessible from the notebook as a data source.

Procedure: Manage attached database connections

The procedure explains how to manage database connections from the Attached data tool when working on a notebook in the editor.

* To edit the details of a database connection:

1. Click the ellipsis and select Edit database connection from the popup menu. This will open the Edit [database_type] connection dialog.

2. In the Edit [database_type] connection dialog, edit the connection details. Find database-specific information in the respective article listed under [Configure a database connection](configure-a-database-connection.html).

3. Click the Save and close button to finish the procedure.

* To edit the introspection scope of an attached database connection:

1. Click the database connection. This will open the detail view of the database schema.

2. Click the ellipsis and select Edit introspection scope from the popup menu.

![Introspected schemas](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/schema_introspections.png)

3. Select or deselect the list items in the Edit introspection scope dialog and click Save and close to finish the procedure.

![Selecting schemas for introspection](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/edit_introspection_scope.png)

* To refresh a database schema, click the ellipsis and select Refresh schema from the popup menu.

> **Note:**
> This action is available only for attached database connections.

* To delete a database connection, click the ellipsis and select Delete database.

> **Warning:**
> This will not only detach the database connection from the notebook but also delete it from the workspace.

Procedure: Find where a database connection is used

For any database connection, you can view all notebooks and SQL cells that use it.

> **Tip:**
> The search includes all notebooks you have access to. Notebooks [shared through a link](share-a-notebook.html#use-links) are included only if you have previously opened them.

To find where a connection is used:

1. In a notebook, select ![paperclip icon](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/attach.svg) (Attached data) in the sidebar.

2. Switch to the Databases tab.

3. Select the connection and switch to the Usages tab.

You will see a list of SQL cells that use this connection. From here, you can open the notebook or SQL cell directly, or copy the cell code.

> **Tip:**
> * To select between displaying all connections with the same credentials or this particular connection, click ![three dots icon](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/dots.svg) (More) and select Single connection or All matching connections.
>
> * To group results by a notebook or query, click ![three dots icon](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/dots.svg) (More) and select the preferred option.
>
> * To search the content of the SQL cells where the connection is used, start typing in the search field. You can exclude a word by using `-`.

## Keywords

database, database connection, attach data, data sources, notebook, notebook data sources, attached data sources, notebook databases, attached data, manage database connections

