mSQL Database
mSQL, or Mini SQL, is a lightweight database engine created to allow fast support and access of stored data without requiring large amounts of memory. This database engine provides a powerful capability for accessing databases within the Virtual Server environment.

The mSQL package includes the powerful database engine, a terminal "monitor" program, a database admin program, a schema viewer, and a C language API. The API and the database engine have both been designed to work in a client/server environment over a TCP/IP network. This makes mSQL the ideal database for operating within your Virtual Server.

Additional information about mSQL can be obtained at the mSQL web site or from the mSQL FAQ.

A Little Technology Shoppe, LLC is pleased to announce that there is currently no cost for use of mSQL- it is provided to our Virtual Server Administrators free of charge (no installation fee or monthly fees). This is a fully site-licensed version of the mSQL database version 2.0.1 for our Virtual Servers. Therefore, you need not purchase an individual license for mSQL insofar as you use mSQL on our Virtual Server Systems.

Installing mSQL v2.0.1
Please use the steps delimited below as your guideline to install mSQL v2.0.1. If you were using a previous version of mSQL (v1.0.x), you will want to pay careful attention to the instructions below as they explain the additional steps needed to upgrade to mSQL v2.0.1.

FreeBSD
% vinstall msql

BSD/OS
% installmsql2

NOTE: If your Virtual Server was ordered after December 1, 1999, you are likely running FreeBSD. To find out which O/S your Virtual Server is running, use the uname command:

% uname

  1. Connect to your Virtual Server using Telnet or SSH and run the mSQL version 2 installation script by typing:

        installmsql2

    The mSQL version 2 installation script will perform the following tasks:

    • Create a "~/msql2db" directory (and a "~/msql2db/.tmp" directory)

    • Determine if you have msql version 1.0.x installed. If you do have msql version 1.0.x installed, the mSQL version 2 installation script will attempt to convert your existing database files to version 2.x database format. Note: the script will not destroy your version 1.0.x database directory, "~/msqldb".

    • Create a msql.acl file with some "intelligent" defaults.

  2. Version 2.0 of mSQL uses different command-line commands than version 1.0.x of mSQL. The following table summarizes the differences:

      mSQL v1.0.x     mSQL v2.x  
    msql msql2
    msqladmin msql2admin
    msqldump msql2dump
    relshow relshow2

    Some "aliases" will also be created in your "~/.cshrc" file to help you remember. You will need to do the following at the command prompt before these aliases take affect:

        source ~/.cshrc

    You only need to do this the first time. When you log in again the changes will be in effect.

  3. Your v2.0.x databases are stored in the following directory, depending on your Virtual Server O/S:

    FreeBSD
    ~/usr/local/Hughes/msqldb
    BSD/OS
    ~/usr/local/msql2/msqldb
    You will eventually want to remove the mSQL v1.0.x directory "~/msqldb" manually when you are certain the upgrade worked. You can do this by typing the following at a command prompt:

        rm -rf ~/msqldb

    Make sure your databases are working correctly before doing this.

  4. Customers upgrading from version 1.0.x will need to also upgrade their mSQL client interfaces. You will note that we have replaced all the client interfaces in the "/usr/local/contrib" directory with mSQL v2.x equivalents. These files include the "w3-msql.tar", "php-2.0-msql_logging.tar", and "perl5.004.tar" files. You will notice that the mSQL v1.0.x tar files are still available in the "/usr/local/contrib/msql1". Please note that the only Perl5 tar file archive that includes support for mSQL v2.x is the "perl5.004.tar" tar archive.

W3-mSQL: The mSQL WWW Interface Package
W3-mSQL provides a programatic interface to the mSQL database system from within an HTML document. It enables the development of entire programs within a WWW page while offering comprehensive access control and security features.

W3-mSQL achieves this by providing a complete programming language embedded within an HTML document. The language, called Lite, is similar is style and syntax to the C programming language and the ESL scripting language. Using W3-mSQL and the embedded Lite language, you can generate HTML code "on-the-fly" in the same way you do when you write custom CGI programs. What's more, you can mix normal HTML code with W3-mSQL code so that you only need to use the CGI styled approach where you actually have to.

Using W3-mSQL
W3-mSQL provides a programatic interface to the mSQL database system from within an HTML document. It enables the development of entire programs within a WWW page while offering comprehensive access control and security features.

W3-mSQL achieves this by providing a complete programming language embedded within an HTML document. The language, called Lite, is similar is style and syntax to the C programming language and the ESL scripting language. Using W3-mSQL and the embedded Lite language, you can generate HTML code "on-the-fly" in the same way you do when you write custom CGI programs. What's more, you can mix normal HTML code with W3-mSQL code so that you only need to use the CGI styled approach where you actually have to.

To install W3-mSQL on your virtual server, connect to your Virtual Server using Telnet or SSH and untar the W3-mSQL archive file into your virtual server directory structure:

   % cd    (this will put you in your home directory)
   % tar xvf /usr/local/contrib/w3-msql.tar

There is W3-mSQL documentation, including detailed examples, available at the mSQL web site. A sample W3-mSQL application is also available for installation on the Virtual Servers. You can install the simple example by untarring an archive file onto your Virtual Server.

% cd    (this will put you in your home directory)
% tar xvf /usr/local/contrib/w3-msql-demo.tar

Once the files are in place run the install script.

% cd ~/www/htdocs/bookmarks
% ./setup_bookmark

You can then access the Bookmark Database example at:

http://YOUR-DOMAIN.com/bookmarks/Welcome.html

Configuring the web server to automatically process W3-mSQL files based upon file extension
W3-mSQL enhanced html files must be pre-processed by the /cgi-bin/w3-msql executable before the server sends the results to the requesting client. Normally, this pre-processing requires the /cgi-bin/w3-msql executable to appear in the URL of each W3-mSQL file on your site:

http://YOUR-DOMAIN.com/cgi-bin/w3-msql/file.msql
The Apache web server can be configured to automatically pre-process W3-mSQL files with the .msql file extension. To setup W3-mSQL redirection, add the following lines to the ~/www/conf/httpd.conf file on your Virtual Server (or the ~/www/conf/srm.conf file, if you Virtual Server was configured before Dec. 8, 1998):
AddHandler htmsql msql
Action htmsql /cgi-bin/w3-msql
Now, it is possible for browsers to access W3-mSQL files this way:
http://YOUR-DOMAIN.com/file.msql
The .msql files will be automatically pre-processed by the /cgi-bin/w3-msql executable without the /cgi-bin/w3-msql executable appearing in the URL path.

Configuring Access Controls for mSQL Databases
When accessing an mSQL database from a CGI, it is important to configure access controls for the database. That can be done by making some additions to the ~/usr/local/msql2/msql.acl file on your Virtual Server. Here is what it looks like:

#
# Access control for mSQL
#
# Entries are of the form
#

# For the bookmark database, I let anyone 
# read it but only I can write it:
#database=bookmarks
#read=*
#write=USERNAME
#access=local
#host=*

This is an entry for the bookmarks demo database that comes with the installation of w3-mSQL. To get this to work remove all the #'s from the bookmarks section so that it looks like this:

#
# Access control for mSQL
#
# Entries are of the form
#

# For the bookmark database, I let anyone 
# read it but only I can write it:
database=bookmarks
read=*
write=USERNAME
access=local
host=*

Now you can access the bookmarks database from a CGI.


Copyright © 1996-2000, Last Modified: 21 January 2000A Little Technology Shoppe, LLC (ALTS.NET)®. All rights reserved. All brand names and product names used on these web pages are trademarks, or trade names of their respective holders.