# How do I properly close a DuckDb database?

**URL:** <https://discourse.julialang.org/t/how-do-i-properly-close-a-duckdb-database/100598>\
**Category:** Data\
**Tags:** database, duckdb\
**Created:** [June 20, 2023, 11:01am UTC](https://discourse.julialang.org/t/how-do-i-properly-close-a-duckdb-database/100598 "2023-06-20T11:01:25Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![AUK1939](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@AUK1939](https://discourse.julialang.org/u/AUK1939)\
**Post date:** [February 21, 2025, 1:44am UTC](https://discourse.julialang.org/t/how-do-i-properly-close-a-duckdb-database/100598/21 "2025-02-21T01:44:28Z")

</div>

Thanks for this. It’s not only that the connection is not closed properly. One can’t even open a read only connection to a duckdb file in Julia when the file is in use on another process. There’s a flag to do this in Python.

```
config = DuckDB.Config()
DuckDB.set_config(config, "access_mode", "READ_ONLY")

db = DuckDB.DB("C:\\Temp\\test.duckdb", config)

```

[Previous page](https://discourse.julialang.org/t/how-do-i-properly-close-a-duckdb-database/100598.md?page=1)
