0

i have been searching around for a few days for the answer to this and i just can't seem to get it to work. I have seen exact examples where it is working for them and I try exactly what they do and it is just not working for me.

Basically what i am trying to do is open a local access DB. I have tried numerous methods and this Jackcess seems by far the best library to use, so i am trying to get it to work with that. I have read their cookbook and gone through all of that, and still no luck so i am coming to you guys in the hope of finding a good solution (i have not posted this question anywhere yet). Here is my code (the relevant part)

The only syntax error i am getting is "DatabaseBuilder.Open" and the error is it cannot find the method, even though i have the libraries included for IO

import com.healthmarketscience.jackcess.*;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         

   Database db = DatabaseBuilder.open(new File("my.mdb"));
    try {
        Table table = db.getTable("Teams");
    } catch (IOException ex) {
        Logger.getLogger(Teams.class.getName()).log(Level.SEVERE, null, ex);
    }

}   

Any help would be greatly appreciated!

The program fails to debug once I have click this buttone the only actual message i can fine is

"Cannot find symbol Symbol : Method Open(file) Location : variable.DatabaseBuilder of type Object"

1 Answers1

0

To use Jackcess you must have at least the following items in the build path for your Java project (or on your CLASSPATH):

  • the Jackcess JAR file itself, and

  • the JAR files for its two mandatory compile-time dependencies from Apache: commons-lang and commons-logging.

In the Eclipse IDE that will look something like this:

   Eclipse.png

Gord Thompson
  • 98,607
  • 26
  • 164
  • 342