The nature of better-sqlite3 database connections #1158
jonathan-hurd
started this conversation in
General
Replies: 1 comment 1 reply
-
I don't think any of your questions is better-sqlite3 specific, so I recommend: https://www.sqlite.org/arch.html Creating a new connection ( better-sqlite3/src/objects/database.lzz Line 168 in 60763a0 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone, I've got some clarifying questions about the nature of database connections in better-sqlite3:
My understanding is that a connection is an object with a reference to a database file and methods for reading and writing to that database. The "connection" part mainly seems like verifying the database file exists. This as opposed to a client/server database where an actual connection needs to be made over a network before interacting with it. Is that right?
If that's the case, is there 1) Any issue with opening multiple connections to a sqlite database in a single application? 2) Any better-sqlite3 specific reasons to open and close a connection each time you interact with the database vs just creating one connection and using it globally?
I'm trying to wrap my head around this and a lot of rules of thumb surrounding database connections are specifically about client/server relational databases and sqlite seems like its own thing in this respect.
Beta Was this translation helpful? Give feedback.
All reactions