UNIVERSITY of VIRGINIA
Computer Science
Research  Teaching  People  Community   

Search
Directory
Contact Us
 
Undergrads • Grad Students • Faculty • Staff • Alumni • Locator • Phones

Msql Library for Perl

It seems that each time one installs the Msql libraries for perl, regardless of which version (Msql.pm, "Mysql," DBD, etc), they all have an annoying association with a particular database. The build process compiles in paths to particular libraries. In particular, it compiles in the path to the msql.conf file. There is no simply way to defeat this behavior.

The workaround is to have an msql directory and a perl library directory which are a matched pair. You need one pair of these per msql daemon you intend to run. In theory, a single daemon can serve multiple databases. It is not necessary to serve one database per daemon.

In point of fact, the msql directory only needs to be separate enoughto have a separate msql.conf file. The bin, lib, include, and other directories within it can all be symbolic links to one main msql installation.

Here's an overview of the process:

  1. Create an msql directory, with your properly configured msql.conf.
  2. Build an instance of the Msql perl library which points at that directory.
  3. Modify your perl script to pull in that particular version of the Msql perl library.


Detailed Overview

  1. Install msql version 2 which you can get at http://www.hughes.com.au/
    Install it in a local directory where you're going to be storing your database (e.g. /home/userid/msql)
  2. Get the database up and running. Edit your msql.conf file in /home/userid/msql to reflect which machine, port, and so on you'll be using. This is critical.
  3. Get the sources for the "Msql-Mysql" perl package. Extract them. To build them correctly, you must do the following:
    a. Run "/usr/cs/bin/perl Makefile.PL" in the main directory.
    b. Answer several questions. Here they are:

    You don't have installed the DBI module, version 0.91 or later. I cannot continue installing the DBD modules.
    You have two options:

    1. Abort now, install the DBI module (available at any CPAN mirror, see 'perldoc CPAN') and rerun me. (Recommended)
    2. Disable installation of the DBD modules and install the non-DBD drivers only.
    Do you want to abort now? [y]
    ANSWER "n"

    Which DBMS do you want to use?

    1. MySQL
    2. mSQL
    3. Both
    Enter your choice: [3]
    ANSWER "2"

    Where is your msql installed? Please tell me the directory that contains the subdir include/. [/usr/local/Hughes]
    ANSWER your msql directory (e.g. /home/userid/msql/msql)

    c. Run "make". Watch it build.
  4. Make a perl directory somewhere in your database area. (e.g. /home/userid/msql/perl) This will house the perl libraries which correspond to a particular database.
  5. Copy several files into your perl directory. "/tmp/Mysql" is the location of the perl stuff I just built.
    cd /tmp/Mysql
    cd blib/arch
    mv auto /home/userid/msql/perl
    cd ../lib
    mv Msql* Mysql* /home/userid/msql/perl
  6. Edit your script to tell perl to load libraries from that directory. Instead of "require Msql;" use the following two lines:

Good luck!



UVa CS Department of Computer Science
School of Engineering, University of Virginia
151 Engineer's Way, P.O. Box 400740
Charlottesville, Virginia 22904-4740

(434) 982-2200  Fax: (434) 982-2214
Web Comments: webteam@cs.virginia.edu
Admissions Inquiries: inquiry@cs.virginia.edu
Site directory, Other addresses
Server statistics
© Created by the CS Web Team