How do I properly close a DuckDb database?

kobusherbst
Tue, 20 Jun 2023 11:01:25 +0000
Data

I cannot run the following code twice in one julia session:

using DuckDB
using DBInterface
db = DuckDB.DB("C:\\Temp\\test.duckdb")
t = DBInterface.execute(db, "SELECT 1")
DuckDB.close_database(db)

On the second run I get the error:

`ERROR: IO Error: Cannot open file "C:\Temp\test.duckdb": The process cannot access the file because it is being used by another process.`

I have tried

DBInterface.close!(db)

in place of

DuckDB.close_database(db)

it makes no difference.

21 posts - 6 participants