I am using below code to creating a copy of mdb file in memory but its giving null pointer exception on DatabaseBuilder constructor that no file exist, what i want is to create a copy of this manipulate it and return the copy to outputstream.
File tmp = new File("test.mdb");
FileChannel channel = MemFileChannel.newChannel(tmp,DatabaseImpl.RW_CHANNEL_MODE);
FileUtils.copyFile(file , tmp);
Database db = new DatabaseBuilder(tmp).setChannel(channel).open();
So you have a pre-made Access database file as a resource in your project. You can open an in-memory copy of that database with Jackcess by first using
Class#getResourceAsStreamto open the resource ...... pass that
InputStreamto a JackcessMemFileChannel...... and then use
DatabaseBuilderto open theDatabasefrom the channel:When finished making changes to the in-memory copy of the database you can send the contents of the channel to an OutputStream. For example,