You've finished building your NeoDBpro database, and you're ready to distribute your publication - now what? Here are a few things you will need to consider when distributing a VisualNEO for Windows publication that contains a database:


Distributing Database Files

When distributing database-enabled publications there are a couple of things you need to keep in mind. Since VisualNEO for Windows doesn't really understand what a database is, it won't automatically include database files when compiling publications using NeoDBpro. Therefore, you will need to take some special steps to insure that any required files are transported along with your compiled publications. Here are several methods you can use to accomplish this:


1. If your publication will include a setup program, you may be able to add your database files to VisualNEO for Windows's Setup Baggage (found on the Setup page of the Compiler).


2. Use VisualNEO for Windows's ExtractFile action to embed your database files inside the compiled publication exe. ExtractFile must be executed at some point before your publication attempts to open the database. The publication's Startup action or the first page's Enter action are good places to put ExtractFile commands. For Example, to extract an Access mdb file into the folder where the compiled publication is located:


ExtractFile "C:\Samples\AddressBook.mdb" "[PubDir]addressbook.mdb"


3. Package your database files along with your publication exe inside a zipped or self-extractive archive.


4. Use a professional setup/installation utility designed to work with your database. Some installation utilities include special functions for installing database ODBC drivers, runtime files, etc.


5. Create your database programmatically using NeoDBpro actions and SQL commands. The example below checks to see if the database exists, then creates the database, table and even some data:


FileExists "[PubDir]AddressBook.mdb" "[Result]"

If "[Result]" "=" "False"

  .database doesn't exist, so create it from scratch

  dbpCreateAccessDatabase "[PubDir]AddressBook.mdb" "Encrypted=No"

  dbpOpenAccessDatabase "AddrBook" "[PubDir]AddressBook.mdb" ""

  .create table

  dbpCreateTable "AddrBook" "States" "Abbr Char(2);Name String(32)"

  .insert data into table

  dbpExecSQL "AddrBook" "INSERT INTO States VALUES('AL', 'Alabama')" ""

  dbpExecSQL "AddrBook" "INSERT INTO States VALUES('AK', 'Alaska')" ""

  dbpExecSQL "AddrBook" "INSERT INTO States VALUES('AZ', 'Arizona')" ""

  dbpExecSQL "AddrBook" "INSERT INTO States VALUES('AR', 'Arkansas')" ""

  ...

EndIf


The methods outlined here work best with databases, like Access, that package everything into a single, easy-to-distribute file. Other databases like MySQL and Oracle, designed for use on network servers, require special installations and are not easily moved between computers. Some databases also require special distribution licenses, so it always a good idea to consult your database documentation to determine the best method for distributing your database.


Regardless of the method you use to distribute your database files, you will want to insure that NeoDBpro can find them. For file-based databases, like Access, the simplest method is to place your database files in the same folder as your publication exe and use VisualNEO for Windows's global [PubDir] variable as part of the file name. For example:


dbpOpenAccessDatabase "AddrBook" "[PubDir]AddressBook.mdb" ""


For server-based databases like MySQL and Oracle, the key to a smooth installation is identifying the correct connection string. Server names, login names, passwords, etc. will need to be customized for each installation. In multi user settings you may want to include a login screen or a configuration option to allow for these differences.


Other Important Files

Many types of databases will consist of more than one file. dBase databases that contain memo or blob fields will also generate a companion dbt file. For example, if your database file is called "sample.dbf", then its companion memo file would be called "sample.dbt". In order for the database to remain intact, both of these files must be distributed along with your publication.


See also Font Considerations.