I am facing an issue when I open an Access 2010 file via creating the connection.
Them I'm creating a statement and executing it. After I get the result set I'm closing it, closing statement and finally the connection.
Even though everything seems to be closed and released, my Access file is still locked and the only thing that can release it is a server shutdown.
As you can see, the file is getting locked even without the ResultSet.
Does anyone know what could be missing in my code to release the file?
P.S. the purpose of the service being implemented is to re-load the data from the Access DB (constantly changing).
Since the file is locked, external tool is unable to overwrite it.
Thanks in advance,
Igor
Last edit: Igor 2014-11-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried every single method on connection and statement objects.
The solution came itself.
Extra command is needed in order to fully release the resource from Ucanaccess perspective.
((UcanaccessConnection) conn).unloadDB();
I hope this helps,
Igor
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Igor,
the same thing may be done without an explicit call to an UCanAccess implementation method,
but using the singleconnection=true connection parameter setting:
conn=DriverManager.getConnection("jdbc:ucanaccess://c:/pippo.mdb;singleconnection=true");
UCanAccess can't close the resources it uses without this being explicited because of caching and efficiency needs.
Cheers Marco
Last edit: Marco Amadei 2014-11-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everyone,
I am facing an issue when I open an Access 2010 file via creating the connection.
Them I'm creating a statement and executing it. After I get the result set I'm closing it, closing statement and finally the connection.
Even though everything seems to be closed and released, my Access file is still locked and the only thing that can release it is a server shutdown.
My code example:
As you can see, the file is getting locked even without the ResultSet.
Does anyone know what could be missing in my code to release the file?
P.S. the purpose of the service being implemented is to re-load the data from the Access DB (constantly changing).
Since the file is locked, external tool is unable to overwrite it.
Thanks in advance,
Igor
Last edit: Igor 2014-11-26
Hi everyone,
I tried every single method on connection and statement objects.
The solution came itself.
Extra command is needed in order to fully release the resource from Ucanaccess perspective.
I hope this helps,
Igor
Hi Igor,
the same thing may be done without an explicit call to an UCanAccess implementation method,
but using the singleconnection=true connection parameter setting:
conn=DriverManager.getConnection("jdbc:ucanaccess://c:/pippo.mdb;singleconnection=true");
UCanAccess can't close the resources it uses without this being explicited because of caching and efficiency needs.
Cheers Marco
Last edit: Marco Amadei 2014-11-26