k_rajesh has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, I have an MS-Access database hosted on a server on which I have space limits... is there anyway I can write a perl script to compress that database remotely... Today, I connect to that db using DBD::ODBC. Regards, Rajesh

Replies are listed 'Best First'.
Re: Compressing an Access database
by InfiniteSilence (Curate) on Sep 28, 2005 at 22:11 UTC
    #!/usr/bin/perl -w use Win32::OLE; my $obj = Win32::OLE->CreateObject("Access.Application"); $obj->DBEngine->CompactDatabase("c:\\temp\\junk.mdb","c:\\temp\\foo2.m +db"); 1;

    Celebrate Intellectual Diversity

      If I remember right from my VB hacking days compacting database does a similar thing as when you empty your recycle bin on Windows.

      Old data that is no longer in the DB (deleted) still takes up space. Until you compact it. That might free up some space, but it doesn't really compress it in a true sense of that word.

      Have you tried freelancing? Check out Scriptlance - I work there.
      There is a problem here... since this is a hosted server, I have no idea of the full path of the mdb (c:\\temp\\junk.mdb, in your example)... but I do know the DSN name... is there anyway to do this compression with this constraint? Regards, Rajesh
        Actually ignore my question! It was pretty stupid actually... I used Cwd to figure out the fullpath :-)...now all I have to do is check whether the code works and come back here to thank you...