This discussion is archived
3 Replies Latest reply: Mar 14, 2013 9:42 AM by jschellSomeoneStoleMyAlias RSS

Anyone able to use JDBC with Microsoft Access 64-bit Driver?

856628 Newbie
Currently Being Moderated
I am trying to move an application from 32 to 64 bit JVM. Two small and seldom used features require import/export to a Microsoft Access database. These features are required but their speed and efficiency are of little concern. A problem which has been well described in JDBC-ODBC on 64-bit, unaligned buffers, "Invalid string or buffer length" on Dec 11, 2011 is stopping my progress.

Briefly, the problem is that iterating over a ResultSet can cause an "Invalid string or buffer length" error on a method to get (Int String Double) data from a field. The original poster found that whether this error happens seems to depend on alignment in the stack and cited a Microsoft forum thread about aligning buffers to 64 bit addresses. Another thread in the JDBC forum suggested retrieving strings before doubles.

I found that this allowed about 1000 rows to be processed before the error rather than failing on the first row. The problem is also avoided by stepping through the code in Eclipse. (Perhaps the stack alignment is affected in a beneficial way.)

I am running 64-bit Java(TM) SE Runtime Environment (build 1.6.0_32-b05) on 64-bit Windows 7 Professional SP1. Office 2010 64 bit is installed and updated as is accessdatabaseengine2010sp1-kb2460011-x64-fullfile-en-us (the Microsoft Access engine (ACE) for 64-bit).

I also coded my test program in Perl, using exactly the same MS driver and it works without a problem. This and the earlier thread leads me to believe that there is either some problem in Java JDBC or this MS buffer alignment requirement is not consistent with ODBC. I have tested with the latest 1.6 and 1.7 Java releases and the latest Microsoft driver ("Microsoft Access Driver (*.mdb, *.accdb)" Version 14.00.6015.1000).

I would greatly appreciate hearing from anyone who has been able to use JDBC with the Microsoft Access 64 bit driver or has spent significant effort and given up. Thanks.

Edited by: user5664922 on Mar 4, 2013 8:00 AM
Readability Improvements

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points