|
The benefits of using a database as an integral piece of your Web application are clear. An RDBMS controls access to the records stored in it, meaning you won't have to do low-level coding to make sure two users don't simultaneously update the same record. In addition, an RDBMS can manage security, ensuring that users only have access to the information they need. Finally, an RDBMS can provide performance enhancements by indexing data and optimizing query performance. An RDBMS can also improve performance by allowing you to build a multitier architecture, performing database processing on a server that is independent of your actual Web server. By the same token, if you don't need any of these features, you don't need an RDBMS. If your applications don't need such power and management capability, follow the keep-it-simple rule and avoid adding unnecessary pieces to your system.
Database options As another option, Microsoft's SQL Server is rapidly gaining popularity as Windows NT's share of the server market grows. While it might be easier to implement SQL Server instead of an Oracle system, it still isn't cheap -- and it requires you to run an NT box as the database platform, an extra hassle if you don't already have one set up.
A better choice? You can download MySQL's binaries and source code for any number of platforms from its Web site. I downloaded the RedHat Linux version and installed it on my VA Research dual 333MHz Pentium II server running RedHat Linux 2.0. The RedHat version came as a series of RPM files that installed easily and quickly. The product includes a GUI-based tutorial that walks you through the basics of using MySQL. Though I had some trouble getting the tutorial to work properly, I was able to run its examples from the command line with no difficulty. The download includes everything you need to set up the Perl database integrator (DBI) to work with MySQL. Because I've used DBI before, I had little trouble working with it in my Perl scripts; first-time users may, however, find its quirky documentation a little frustrating. There's some documentation online, but the best way to figure it out is to look at the examples in the mysql.pm DBI module loaded in the installation process. As an example of how MySQL works, here's a short snippet of Perl that extracts one row of data from a table called "demo" and prints out the results:
#!/usr/bin/perl use Mysql; $dbh = Mysql->connect(localhost, tutor); $sth = $dbh->query(select * from demo); @arr = $sth->fetchrow; print $arr[0] $arr[1] $arr[2] \n; Inserting records uses a similar process. Wrapping the constructs needed for HTML around this code makes building database applications fairly simple. One nice feature of DBI is the fact that if you change database platforms, you simply change the DBI module used to connect. Most, if not all, of your code will work with the new RDBMS with no modification.
Depending on your platform, many other free or low-cost RDBMS solutions
are available, including Ingres, mSQL, and Postgress. Download one
today and see how it meets your database needs!
|
About the author
Eric Hammond is a technology analyst in InfoWorld's Test
Center. Previously he was a computer scientist at the Department of
Energy.
Reach Yun at eric.hammond@ne-dev.com.
If you have problems with this magazine, contact
webmaster@ne-dev.com
URL: http://www.ne-dev.com/ned-02-1998/ned-02-develop.html
Last modified: Saturday, November 20, 1999
HYIP Monitor