How to Distribute a Large Database with an Application

Last reviewed: October 18, 1996
Article ID: Q119284
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 5.0
  • Microsoft FoxPro for Windows Distribution Kit, versions 2.5x, 2.6
  • Microsoft FoxPro for MS-DOS Distribution Kit, versions 2.5x, 2.6
  • Microsoft FoxPro for Macintosh Distribution Kit, versions 2.5b, 2.5c

SUMMARY

It is often desirable to ship large databases with applications. However, the Setup Wizard is not designed to split large files and may not be able to compress large database files, possibly resulting in the error message "Incorrect number of bytes written to disk - source file or destination disk may be corrupted - use ChkDsk."

To work around the size limitations of the Setup Wizard, you can use a number of third-party compression utilities, such as PKZIP, LHARC, StuffIt, and so on, to compress large database files. Many of these compression utilities are available on bulletin board services.

This article demonstrates how to use one of these utilities, PKZIP, to compress a large database so that it can be shipped with an application.

MORE INFORMATION

To ship a large database with your application, compress the database file, convert it to a self-extracting executable file, and then execute some code to expand (decompress) the compressed file.

For example, suppose you want to compress the files PICFILES.DBF and PICFILES.FPT. If you are using PKWare's PKZIP utility, you can compress these files into a self-extracting executable file named PICDBF.EXE by typing the following commands at the MS-DOS command prompt:

   PKZIP picdbf picfiles.dbf
   PKZIP picdbf picfiles.fpt
   ZIP2EXE picdbf

Move the newly-created PICDBF.EXE file to your source files directory. Do NOT put the PICFILES.DBF or PICFILES.FPT file in this directory.

Add the following code to the first program in your project:

   * This code assumes the data file to be extracted is named
   * PICFILES.DBF. The example tested for this article was over 5 MB,
   * and compressed to 1.3 MB. The K value of 240 used in the RUN
   * command is an empirical value that has proven successful in our
   * tests, but your results may vary. A lower value may be possible.

   IF !FILE('picfiles.dbf') OR !FILE('picfiles.fpt')

      * The data is shipped as a self-extracting executable with the
      * name PICDBF.EXE. It may be wise to include the -o parameter to
      * overwrite files when extracting databases.

      RUN /240 picdbf.exe -o

      * The WAIT window below will keep FoxPro from continuing in
      * multithreaded operating systems such as Microsoft Windows NT.

      DO WHILE !FILE('picfiles.fpt')
         WAIT WINDOW 'Extracting files...' TIMEOUT 5
      ENDDO

   ENDIF

IMPORTANT: The compression software that you decide to use may require additional licensing for distribution in a commercial application. Contact the compression vendor for licensing details.

The file-compression utilities mentioned above are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability.


Additional reference words: 5.00 FoxMac FoxDos FoxWin 2.50 2.50a 2.50b
2.50c 2.60 errmsg err msg setupwizard dk
KBCategory: kbtool kb3rdparty kbprg kberrmsg
KBSubcategory: FxtoolDk


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 18, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.