Menu

Changes in an open MS Access database not seen by MS Access

Help
S
2015-05-08
2015-09-29
  • S

    S - 2015-05-08

    If I have a database open in MS Access and I use this library to insert a row into a table in that database , the new row is not seen by MS Access. Only after I close MS Access and reopen it that the new row appears. Is there something special that needs to be done after the commit that I am missing ?

    thanks
    Nz

     
    • Gord Thompson

      Gord Thompson - 2015-05-09

      No, you haven't missed anything. You really do need to close the database and re-open it.

      UCanAccess uses Jackcess as its record manager and Jackcess writes directly to the database file without using the Access Database Engine. If Access has an open connection to the database file (via the Access Database Engine) then it is not notified of the changes to the data. Closing and re-opening the database file forces a new connection and allows you to see the new record.

       
  • Wayne Johnson

    Wayne Johnson - 2015-09-25

    Thanks, Gord, for the explanation. Is avoiding the ADE how the goal of an "all-Java" solution is being acheived?

    Is there no solution or workaround for this problem? Our system relies on a Java program writing info to the Access database and other programs written in C++ reading that data in realtime. If we can't get Java8 to play nicely we will be forced to stick with Java7.

     
    • Gord Thompson

      Gord Thompson - 2015-09-25

      Is avoiding the ADE how the goal of an "all-Java" solution is being acheived?

      That's probably it, especially if the original Jackcess developers wanted their solution to work on any machine where Java runs (i.e., not just on Windows machines).

      Is there no solution or workaround for this problem? 

      Marco offers a couple of suggestions in his response below. One other option might be for you to do your processing using C# instead of Java.

       
      • Wayne Johnson

        Wayne Johnson - 2015-09-28

        Does MS Access run on other platforms other than MS Windows? I suppose you could copy an Access database to Linux and try to use it with Java. But why would you, since Access is a Windows thing anyway?

        I suspect Oracle pulled support out of Java8 so we would be encouraged to use Oracle databases instead of MS. This has already been a costly impact to our project since I had to rewrite a lot of Java code. Now we have to make changes to the C++ parts of the system that use the database concurrently (acc to Marco).

        Please pardon the rant.

         
        • Marco Amadei

          Marco Amadei - 2015-09-28

          I wouldn't agree with you because maybe someone needs interoperability, yet you're welcome.

           
        • Gord Thompson

          Gord Thompson - 2015-09-28

          Does MS Access run on other platforms other than MS Windows? I suppose you could copy an Access database to Linux and try to use it with Java. But why would you, since Access is a Windows thing anyway?

          The Microsoft Access application and Access ODBC/OLEDB drivers do not run on platforms other than Windows, but people in a non-Windows environment may find themselves with Access database files containing information that they need to extract (or otherwise manipulate). Jackcess and UCanAccess offer those people the ability to "get at" the data without having to buy a Windows box.

          I suspect Oracle pulled support out of Java8 so we would be encouraged to use Oracle databases instead of MS.

          That's possible, although I doubt that Oracle is too concerned about Microsoft Access eating into their database business. They're probably much more concerned about Microsoft SQL Server and we don't need ODBC to use it. (There are at least two JDBC drivers available for that platform: Microsoft's own, and jTDS.)

          More likely reasons for dropping the JDBC-ODBC Bridge in Java 8 are:

          • it was never promoted as a component for production use (more like a kluge to help get data out of an ODBC data source and into a database with a proper JDBC driver),
          • it was never officially supported,
          • it was buggy.
           
      • Gord Thompson

        Gord Thompson - 2015-09-29

        Yet another workaround might be to copy the JDBC-ODBC Bridge components from Java 7 into Java 8 as described in the Stack Overflow answer here ...

        http://stackoverflow.com/a/32825016/2144390

        ... although I wouldn't recommend doing that on a production system. (Bear in mind that the JDBC-ODBC Bridge was not recommended for production use anyway.)

         
  • Marco Amadei

    Marco Amadei - 2015-09-25

    The solution can't be in the java part of your system, but in the C++ one. Ucanaccess would have detected upgrades done by c++. The viceversa isn't true. If you're working in polling you need to open a new connection at each query and then close it if you want see the upgrades. You can also choose a tradeoff: opening a new connection just after a reasonable interval of time.This generally doesn't involve a great reengineering work.

     

    Last edit: Marco Amadei 2015-09-25

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.