---
title: setCurrentDatabase
description: "Catalog.setCurrentDatabase method in PySpark: Sets the current default database in this session."
canonical_url: https://docs.databricks.com/gcp/en/pyspark/reference/classes/catalog/setCurrentDatabase
---

# setCurrentDatabase

Sets the current default database in this session.

## Syntax

```
setCurrentDatabase(dbName: str)
```

## Parameters

| Parameter | Type | Description                                         |
| --------- | ---- | --------------------------------------------------- |
| `dbName`  | str  | Name of the database to set as the current default. |

## Examples

```python
spark.catalog.setCurrentDatabase("default")
```
