Search code examples
javams-accessjdbcjdbc-odbc

Include Java 7 ODBC classes to Java 8


I'm developing a Java application that needs to communicate with a Microsoft Access Database. Since Java 8, the ODBC-JDBC connection has been removed. For this reason we started looking at a Native driver, JDBC driver.

We used UCanAccess and this seemed to work well, but after more intensive testing we found out that the processing speed is not high enough which means we can't use this as a replacement.

We researched multiple libraries that provide this functionality and not one of them could provide us the speed we want. We are thinking of refactoring (optimizing) the code to gain performance, unfortunately this takes time.

We found a blog that describes how we could enable the ODBC functionality in Java 8 by picking some classes from the Java 7 JRE. This would be a great way to win some time so we can optimize the code. http://bigfatball.blogspot.nl/2016/03/how-to-enable-jdbc-odbc-bridge-for-jdk-8.html

We have control over the JRE that is installed (we can add the jar and dll manually) but we do need to update every now and then.

- What is the risk of 'hacking' this Java 7 functionality into Java 8?


Solution

  • I cannot, in good conscience, recommend "hacking" the JDBC-ODBC Bridge components from Java 7 into Java 8 because aside from it just sounding like a Bad Idea™, the JDBC-ODBC Bridge

    • was never officially supported and never intended for production use,
    • was notoriously buggy, and
    • was never able to work properly with Access ODBC to manipulate Unicode characters above code point U+007F.

    If I found myself in a similar situation then I would consider the following:

    1. If this project was only targeting the Windows platform and interoperability with an Access database was essential then I would seriously consider developing the application in C# instead of Java.

    2. If coding in Java was an absolute requirement and I expected to refactor my code in the near term then I would try to stick with Java 7 until the refactoring was complete and then see if UCanAccess could offer acceptable performance.

    3. If running on Java 8 right now was mandated and I needed an immediate solution for working with Access databases I would consider installing SQL Server Express Edition (free), creating a SQL Server "Linked Server" for the Access database, and then using the SQL Server JDBC driver or jTDS to manipulate the Access database using T-SQL.