eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Free support
 ::   Support forums
 ::   Frequently asked questions
 ::   Functional Specifications
 ::   eXtropia Tutorials
 ::   Books by eXtropia
 ::   Other books
 ::   Offsite resources
eXtropia FAQs
eXtropia WebDB FAQ
How do I make a Local MySQL Database to Test on?
How do I connect to a MySQL Datasource?
How can I display records publicly, but prevent changes except by me?
What is a relational database and how do I build one?
 


Q: How do I make a Local MySQL Database to Test on?

Answer: Brett Winn Posted this on the BBS:

This post is for anyone interested in hosting their own 
working copy of MySQL (on a UNIX machine). 
The MySQL manual states that the following drivers are 
needed to support PERL. 

(You will need a gcc or other "C compiler" before 
attempting these installations) 
Data-Dumper-2.101 
DBI/DBI-1.13.tar.gz 
Data/Data-ShowTable-3.3.tar.gz 
DBD/Msql-Mysql-modules-1.2217.tar.gz 

I installed them as follows: (The MySQL manual 
inidcated that order is important.) 

The following archives are required (version 
numbers may have changed, these are the ones I 
used): 


a. If your platform has a C compiler AND is supported 
by xsubpp: 

gzip -c -d Data-Dumper-2.101.tar.gz | tar xvf - 
cd Data-Dumper-2.101 
perl Makefile.PL 
make test 
make install 

gzip -cd DBI-1.13.tar.gz | tar xf - 
cd DBI-1.13 
perl Makefile.PL 
make 
make test 
make install 

gzip -cd Data-ShowTable-3.3.tar.gz | tar xf - 
cd Data-ShowTable-3.3 
perl Makefile.PL 
make 
make install # Don't try make test, the test suite is 
broken 

INSTALLATION: 
1. Unpack the archive 
sh Data-ShowTable-3.1.shar 
or: 
gnutar xvfz Data-ShowTable-3.1.tar.gz 

2. Generate the "Makefile": 
perl Makefile.PL 
Be sure that you are using perl 5.002 or later. 

3. Make the installable files: 
make 

4. Test the new files: 
make test 

5. Install the modules and "showtable" program into 
the configured 
Perl library and binary directories. 
make install 


cd .. 
gzip -cd Msql-Mysql-modules-1.2217.tar.gz | tar xf - 
cd Msql-Mysql-modules-1.2217 
perl Makefile.PL 
make 
make test 
make install 

During "perl Makefile.PL" you will be prompted some  questions. 
In  particular you have to choose the installed drivers  
(MySQL, mSQL2 and/or  mSQL1). The MySQL driver will be called DBD::mysql, 
a single mSQL driver  will be called DBD::mSQL. If you want to support both mSQL1 and mSQL2, 
they former will be  DBD::mSQL1.   (This in formation is taken  directly from the 
README and INSTALLATION files of the various packages, as well the MySQL manual.  )



Q: How do I connect to a MySQL Datasource?

Answer:

WebDB and the ADT allow you to connect to flat files, MySQL, Oracle, and Sybase, and even others! You essentially must alter the @BASIC_DATASOURCE_CONFIG_PARAMS for the actual as well as for authentication. The Authentication Setup is about 20% down most CGIs. The Datasource is about 50% down most CGIs. You must be sure to keep all single and double quotes, commas, and cases the same as you find them.

Here is a typical setup.

my @BASIC_DATASOURCE_CONFIG_PARAMS = ( 
-TYPE => 'DBI', 
-DBI_DSN => 'mysql:host=localhost;database=extropia', 
-TABLE => 'address_book', 
-USERNAME => 'extropia', 
-PASSWORD => 'achtung', 
-FIELD_NAMES => \@DATASOURCE_FIELD_NAMES, 
-KEY_FIELDS => ['record_id'], 
-FIELD_TYPES => { 
record_id => 'Autoincrement' 
}, 
); 
Q: Can WebDB Send me Email on Changes to the Database?

Answer:

Absolutely! The WebWare ADT is designed to do just about anything you want, whenever you want! Our own Janet Tan explains:

You have to set the 
-SEND_EMAIL_ON_DELETE_FLAG 
-SEND_EMAIL_ON_MODIFY_FLAG 
-SEND_EMAIL_ON_ADD_FLAG 
in the address_book.cgi to 1. 

This goes for other WebWare programs as well. Read more about Sending mail.

Q: How can I display records publicly, but prevent changes except by me?

Answer:

There are a couple of ways to accomplish this.

1. Use the news.cgi and news_admin.cgi methods. , the "public view" removes the buttons (except for details) the "public view was reached by the regular url, but an administrative view was reached from a seperate cgi - it was utilizing the same datasource but the admin view was sealed off and only you could access it. This is the way several of our WebWare programs operate. (Thanks to Kerry Garvey for the simple wording!)

2. Selena Sol Wrote:

In the @APPLICATION_SETUP definition you will find a section that is 
-ALLOW_ADDITIONS_FLAG => 1, 
-ALLOW_DELETIONS_FLAG => 1, 
-ALLOW_MODIFICATIONS_FLAG => 1, 

Set Modify and Delte to 0 instead of 1