2

All,

I have a simple java code to let me copy paste file from one folder to another for a weekly backup. This code works fine however my problem is i want to compress the file while saving. the size of the (.nsf lotus notes database file) is almost 1.5 gb and I plan to run a weekly backup. I tried using the zip package available in java but it does not compress the size is still the same.

Can anyone please give me some usefull tip or guidance on how to compress a .nsf lotus notes database file using java?

public static void main(String[] args) 
{
    System.out.println("Copy Paste Process Started ");

    DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
    Date date = new Date();
    String reportDate = dateFormat.format(date);
    System.out.println(reportDate);

    File f1= new File("C:\\notes\\data\\people\\xyz.nsf");
    File f2= new File("E:\\Backup\\xyz"+reportDate+".nsf");
    FileUtils.copyFile(f1, f2);

    System.out.println("Done");

}
Marsh
  • 417
  • 5
  • 19
  • If you manually compress the file using eg WinZip or WinRAR, does it actually become smaller? Not familiar with nsf files, but it's always possible that they are some precompressed format. – fvu Dec 07 '13 at 11:40
  • This suggests the data file is already compressed, or possibly encrypted. Can you significantly compress the file with an external utility? – Jongware Dec 07 '13 at 11:41
  • Thank you for your reply guys i just had to make few changes in the notes database setting to allow it to be compressed, it now works. – Marsh Dec 07 '13 at 13:10

1 Answers1

5

Set database's property to Do not locally encrypt this database. You can find this property in Encryption Settings....

After setting the property you have to Compact your database (second tab of database's properties). Then, the size of your database should get reduced significantly using java zip package.

You have to set this properties only once.

Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
  • Thank you very much Knut that helped, my java code now compresses the notes database after i made those chages. – Marsh Dec 07 '13 at 13:09
  • 2
    Of course, doing this just made the data less secure. Now anyone who gets hold of the file can read the database without knowing the password for your Notes id. – Richard Schwartz Dec 07 '13 at 16:31
  • Hi Richard, Yes i agree i read that when i selected Do not locally encrypt this database. Is there a way to tackle that problem or is it that i have to sacrifice the data to be less secure in my case ? – Marsh Dec 07 '13 at 20:12
  • 1
    Handle the database like other private/confidential files (Word files, Excel files) on your drives: use encryption tools like TrueCrypt to encrypt drives or folders. Then is not just Notes a save place to store data... – Knut Herrmann Dec 07 '13 at 20:29
  • 2
    If the data is sensitive, the zipped backup requires protection, too, and you may not be able to count on filesystem encryption like TrueCrypt for that. I don't believe the java.util.zip package supports encrypted zips, but the answers to this post suggest some alternatives: http://stackoverflow.com/questions/166340/write-a-password-protected-zip-file-in-java – Richard Schwartz Dec 07 '13 at 22:27