|
-
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
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
|