Menu

Beginners...

Anonymous
2006-08-23
2012-10-04
  • Anonymous

    Anonymous - 2006-08-23

    Hey,

    There doesn't seem to be too much FAQ for beginners. I'm new to Java and Jackcess, but I'm still a bit confused on a few things.

    [code]

    // TEST PROGRAM FOR CONNECTING TO AN ACCESS DATABASE

    import java.io.;
    import java.sql.
    ;
    import com.healthmarketscience.jackcess.*;

    public class dbtest {
    public static void main(String[] args) {
    System.out.println("\n\tHello world!!!\n");
    try {
    System.out.println("\tTrying to access database...\n\n");
    Database.open(new File("pdb.mdb")).getTable("Users").display();}

    catch (Exception ae) {
        //System.out.println(ae.getID());
        System.out.println("Something went terribly wrong");
    }
    

    }
    }

    [/code]

    Its difficult to know what to include / import, how to import and where to place it for the import.

    Since Microsoft Access is such a portable type of database, its my assumption that Jackcess is geared toward the same mentality.

    Sorry I'm so new to Java. : )

    -FBL

     

    Related

    Code: code

    • Anonymous

      Anonymous - 2006-10-15

      correction, it's java -cp fooDep1.jar;fooDep2.jar;fooDep3.jar MyClass

      Notice the semi-colon's.

      -FBL

       
    • James Ahlborn

      James Ahlborn - 2006-10-16

      actually, it depends what platform you are on. semicolons is a windows thing. on unix-like OSes, you would need to use colons.

       
      • Anonymous

        Anonymous - 2006-10-16

        oh wow... makes sense... thanks for the heads up... i'm developing for both.

        Cheers.

        -FBL

         
    • James Ahlborn

      James Ahlborn - 2006-08-25

      i'm willing to give you some pointers, but i honestly have no idea what you are asking. the code you included seems to be working code to open a mdb file and display the "Users" table. What exactly are you trying to figure out?

       
    • Anonymous

      Anonymous - 2006-08-25

      Ok... my brother helped me out on this one...

      He had to extract the files inside the jar dependencies to the working directory...

      Basically, I'm building fine but getting run errors, but I can't find any solid "beginner" documentation on how to set up the dependencies.

      I know this is more of a Java thing than a Jackcess thing, and I'm new to Java, but even my brother, who's fluent in it had a hard time setting them up because he'd never included so many dependencies like this.

      I'd be willing to write a quick howto and sample code (even supply a sample database) because this is a very usefull tool. I just need some reinforcement on how to set all of these dependencies up. I'll try to upload and link the project so far. Thanks for the quick response.

      -FBL

       
      • James Ahlborn

        James Ahlborn - 2006-08-26

        sounds like you need to setup your classpath. when using a bunch of jars, you can stick that jar file on your classpath. example:

        java -cp fooDep1.jar:fooDep2.jar:fooDep3.jar MyClass

        the "fooDep1.jar" would of course be the path to the jar file, so if you had them all in a specific dir, it might be "lib/fooDep1.jar".

         
    • Anonymous

      Anonymous - 2006-08-28

      Perfect. Thanks so much!!!

      Haven't tried it yet since they're extracted and working, but that helps a bunch!

       

Log in to post a comment.