-
March 21st, 2014, 06:11 AM
#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
-
March 21st, 2014, 10:29 AM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|