CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2014
    Posts
    1

    How to read MDB file in java

    i want read a (.accdb) file and i approached by this way .Below is code but i am getting this error-- java.lang.NullPointerException
    -----------------------------------
    package mdb;

    import java.io.File;
    import java.io.IOException;
    import java.util.Map;

    import com.healthmarketscience.jackcess.Database;
    import com.healthmarketscience.jackcess.Table;
    import com.healthmarketscience.jackcess.query.Query.Row;
    import mdb.DatabaseBuilder;


    public class Readwritemdb {

    public static void main(String[] args) throws IOException {
    try {
    String path="D:\\Anand\\mymdb.accdb";
    Database db = DatabaseBuilder.open(new File(path));
    System.out.println("dbbb--"+db);
    Table table = db.getTable("ContractInfo");

    for(Map row : table) {
    System.out.println("Column 'a' has value: " + row.get("a"));
    }


    } catch (IOException e) {

    e.printStackTrace();
    }





    }

    }
    ---------------------------

    please help

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: How to read MDB file in java

    What variable has the null value? Look at the error message for the line number for where the error happens, then look at the line and find the variable, then backtrack in the code to find out why that variable does not have a valid value.
    Norm

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured