connection pooling, closing database

Topics: Help
Jun 16, 2011 at 11:36 PM

I am doing some operations with various tile cache files (.gmdb).

I find that GMap tends to hold SQLite files in a locked state. Sometimes this may be reasonable, but other times perhaps not. It seems this lock perhaps does release after some minutes.

Anyhow an example is this, i made a call to this function, to operate on a file separate from the folder where tiles are being used for the map drawing.

SQLitePureImageCache.VacuumDb

When i made this call i can see (using procexp.exe) the file open. It does not close however.

In reading up on SQLite it sounds like this parameter will cause the file to stay open.

;Pooling=True

I also found out that there is a function that might be helpful to close in this case, but i am not sure where the connection is that i would use for this call.

SQLiteConnection.ClearAllPools()

I'm wondering if there is a fix or workaround for this. It appears that maybe import/export functions may have the same issue.

I may also wish to find a way to flush out the connections associated with the tile cache used for the display also so if there are ideas on that too it would be great.

Coordinator
Jun 17, 2011 at 12:59 AM

database file is locked when new tile is saved, stop browsing the map and it should be lock free, anyway i haven't done intense testing on these issues yet...

Jun 17, 2011 at 4:34 AM

Thanks for your comments,

So i recompiled it sometimes seems to be faster about releasing, perhaps 10 sec. The vacuum does seem to release eventually. Strangely if i happen to access another gmdb in the same application, it seems to cause the the file i just optimized to release.

I changed the VacuumDb, just removed the pooling, seems to run ok and the lock goes right after the optimize is done.

I can guess that connection pooling might be important in the main map drawing/caching stuff. From what i read it sounds like pooling helps when doing a lot of open/close - i presume the tiles do lots of this.

I'm less certain if it is useful in utility functions like import/export/optimize/createdb etc.

Anyhow i'll do some more testing here as i get time, just thought i'd see if there was already some knowledge out there on this.

Coordinator
Jun 17, 2011 at 7:10 AM

i see, i'll remove pooling options from utility functions, thanks for testing!