It's not "singleConnection" that would put a lock on a database file, it's "openExclusive" that would be expected to do it. (In recent versions of UCanAccess, "immediatelyReleaseResources" has replaced "singleConnection" as the preferred option name because the "singleConnection" name was confusing.)
UCanAccess behaves a bit differently from Access when it comes to "exclusive access". If one UCanAccess process already has the database open with "openExclusive" then a second UCanAccess process will not be prevented from opening the database altogether, it will simply be forced to read-only mode.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What version of UCanAccess adds the (much better named) "immediatelyReleaseResources" alias for "singleConnection"? The main website still talks about the latter.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
can someone explain me why this connection:
is not preventing an second instance of the application from accessing the .mdb file?
The first instance is not calling conn.close(); & there is an created <dbname>.ldb file in the DB folder.
Any ideas about this?
Hi Gerrit. Two things:
It's not "singleConnection" that would put a lock on a database file, it's "openExclusive" that would be expected to do it. (In recent versions of UCanAccess, "immediatelyReleaseResources" has replaced "singleConnection" as the preferred option name because the "singleConnection" name was confusing.)
UCanAccess behaves a bit differently from Access when it comes to "exclusive access". If one UCanAccess process already has the database open with "openExclusive" then a second UCanAccess process will not be prevented from opening the database altogether, it will simply be forced to read-only mode.
Thank you very much gordon, it makes it much clearer.
Now everything is so easy:
if(conn.isReadOnly()){//To Do}
Last edit: Gerrit 2016-11-29
What version of UCanAccess adds the (much better named) "immediatelyReleaseResources" alias for "singleConnection"? The main website still talks about the latter.
Hi Raven. The new name was introduced in v3.0.6.
Thanks for the reminder about the website. (Marco: I have updated the "Connection Properties" section of site.html.)
I forgot this documentation, thank you!