close

Bun

Symbol

Database.close

close(throwOnError?: boolean): void

Close the database connection.

It is safe to call this method multiple times. If the database is already closed, this is a no-op. Running queries after the database has been closed will throw an error.

@param throwOnError

If true, then the database will throw an error if it is in use

db.close();

This is called automatically when the database instance is garbage collected.

Internally, this calls sqlite3_close_v2.