SQLite Connection Limit
SQLite Connection Limit
Is there any hard coded connection limit built into the PB SQLite support? I switched an app from using ODBC (with the SQlite ODBC driver) to the native PB support and now the application hangs if 3 or 4 connections are made to the db file (it seems to vary on XP and Vista?). None are explicitly asking for exclusive access but is that built-in to the PB lib somehow?
AFAIK SQlite itself enforces no limit other than whole-database locking on write (which is fine since the clients I'm speaking of only need read access)..
AFAIK SQlite itself enforces no limit other than whole-database locking on write (which is fine since the clients I'm speaking of only need read access)..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Yes, I do and there are no errors - the OpenDatabase call never returns.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
-
- PureBasic Expert
- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
I just tested a huge project i am working on with 8 concurrent clients and all works well... 2 databases, 16 connections...
I have noticed sqlite plugin is very picky about DatabaseQuery() and DatabaseUpdate() so be very careful and always test each sql statement with both !
If one gives an error, try the other command with the same sql statement!
Sometimes, when i'm in SQLITE MANAGER in firefox i get db locks, specially after a begin transaction / commit, they always lock the database, so try to avoid them under sqlite PB!
They work great outside but under PB i get db locks ...
I have noticed sqlite plugin is very picky about DatabaseQuery() and DatabaseUpdate() so be very careful and always test each sql statement with both !
If one gives an error, try the other command with the same sql statement!
Sometimes, when i'm in SQLITE MANAGER in firefox i get db locks, specially after a begin transaction / commit, they always lock the database, so try to avoid them under sqlite PB!
They work great outside but under PB i get db locks ...
SQLite's locking is whole-file locking so you'll run into problems trying to write to the database from concurrent connections.
DatabaseUpdate() should be used for queries that write to the database (INSERT UPDATE DELETE, ALTER, etc), DatabaseQuery() is only used when the query returns a result set (SELECT).
In your project are you connecting to a file on a network share?
DatabaseUpdate() should be used for queries that write to the database (INSERT UPDATE DELETE, ALTER, etc), DatabaseQuery() is only used when the query returns a result set (SELECT).
In your project are you connecting to a file on a network share?
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
-
- PureBasic Expert
- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
Yes, it's on a network share and i had no troubles so far...
I also test it on my pen drive for even slower times, and it works too.
Oh, wait, but i'm using the beta revised version!
http://purebasic.com/beta/windows/
Maybe that helps!
I also test it on my pen drive for even slower times, and it works too.
Oh, wait, but i'm using the beta revised version!
http://purebasic.com/beta/windows/
Maybe that helps!
I'll re-run all my tests with the newest version..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Unfortunately it is still happening.. It looks like the very first call to OpenDatabase on the 4th workstation hangs everything.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out "Pragmas" http://www.sqlite.org/pragma.html
if you dont use a single access.
if you dont use a single access.
Thats useful to know, what params are used?Fred wrote:OpenDatabase for SQLite is just a wrapper to sqlite3_open_v2(), so i don't think it's specific to PB, you may try to test with the API to be sure..
The sqlite3_open_v2() interface works like sqlite3_open() except that it acccepts two additional parameters for additional control over the new database connection. The flags parameter can be one of:
- SQLITE_OPEN_READONLY
- SQLITE_OPEN_READWRITE
- SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
The first value opens the database read-only. If the database does not previously exist, an error is returned. The second option opens the database for reading and writing if possible, or reading only if if the file is write protected. In either case the database must already exist or an error is returned. The third option opens the database for reading and writing and creates it if it does not already exist. The third options is behavior that is always used for sqlite3_open() and sqlite3_open16().
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
By default, it allows many access, or i miss something ?dige wrote:Check out "Pragmas" http://www.sqlite.org/pragma.html
if you dont use a single access.
pdwyer: it uses SQLITE_OPEN_READWRITE
Cheers Fred!
Karbon, maybe as a test you can try the API method and use the readonly flag to open the DB, see it it helps.
My guess is that over time the PB sqlite implementation will mature and put more options for us to use but it might not quite be everything to everyone in this first release
Karbon, maybe as a test you can try the API method and use the readonly flag to open the DB, see it it helps.
My guess is that over time the PB sqlite implementation will mature and put more options for us to use but it might not quite be everything to everyone in this first release
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
I've solved it, or at least I think I have..
The database was being locked in between connections (at application start the DB is written to several times). Apparently the ODBC driver had additional checks built-in and that is why it was working before using ODBC.
Thanks to all!
The database was being locked in between connections (at application start the DB is written to several times). Apparently the ODBC driver had additional checks built-in and that is why it was working before using ODBC.
Thanks to all!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net