We have a VB6 process that connects to an Access database using ADODB. This process creates a JVM and runs Java code which connects to the same database using JdbcOdbc, but this is awkward and it's going to go away with Java 8 and later. We have some new Java code which uses JPA2.1, Eclipselink, and UCanAccess/Jackcess. Things are working relatively smoothly.
However...
The difficulty is when we write some data through JPA and then need to return control to the VB6 side and do some further read/write operations. We are aware that UCanAccess/Jackcess do not always play nice with concurrent access from another technology or process, so we are closing the connection on the VB side before calling the Java side. On the Java side, an EntityManagerFactory is created, and JPA is utilized in fairly vanilla fashion.
Once we return control to the VB side, we have two choices: (1) we can charge right in and then we get database corruption problems, or (2) we can run a loop that tries to get an exclusive handle to the file every five seconds until success, and then proceed. However, with our current implementation this latter option takes 1-2 minutes, which is not acceptable.
THE QUESTION:
What is the best way to Commit, Close, Flush, and otherwise finish the write process as quickly as possible, and get notification when it is complete?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, Gord and Marco,
Can you help me with the following scenario:
We have a VB6 process that connects to an Access database using ADODB. This process creates a JVM and runs Java code which connects to the same database using JdbcOdbc, but this is awkward and it's going to go away with Java 8 and later. We have some new Java code which uses JPA2.1, Eclipselink, and UCanAccess/Jackcess. Things are working relatively smoothly.
However...
The difficulty is when we write some data through JPA and then need to return control to the VB6 side and do some further read/write operations. We are aware that UCanAccess/Jackcess do not always play nice with concurrent access from another technology or process, so we are closing the connection on the VB side before calling the Java side. On the Java side, an EntityManagerFactory is created, and JPA is utilized in fairly vanilla fashion.
Once we return control to the VB side, we have two choices: (1) we can charge right in and then we get database corruption problems, or (2) we can run a loop that tries to get an exclusive handle to the file every five seconds until success, and then proceed. However, with our current implementation this latter option takes 1-2 minutes, which is not acceptable.
THE QUESTION:
What is the best way to Commit, Close, Flush, and otherwise finish the write process as quickly as possible, and get notification when it is complete?
Have you tried the immediatelyReleaseResources=true connection parameter?
Last edit: Marco Amadei 2019-05-01
AHA! I think this has fixed the problem. Thank you, Marco!
It looks like the documentation page has expanded since last time I looked at it. I suppose I should check it more often. Thanks again!
Marco,
Is there a performance penalty for using 'immediatelyReleaseResources'?