DevX Skillbuilding for IBM DeveloperWorks
DevX Skillbuilding for IBM DeveloperWorks
DevX Skillbuilding for IBM DeveloperWorks
Get regular email alerts when we publish new features!
DevX Update for IBM developerWorks

More Newsletters

IBM's Cloudscape Versus MySQL

Both Cloudscape and MySQL open-source relational databases can be obtained at no cost for most users. But there are many differences that can strongly affect which you choose. 


The age of industrial-strength open-source databases has arrived. No longer collaborative science experiments, open-source database projects are growing up and going mainstream. In a recent survey, Evans Data Corp. found that two-thirds of database developers were currently using open-source databases, not just because of the cost-effectiveness of open-source software but also because they felt that the performance and scalability of open-source databases had increased to the point where they are acceptable for use in corporate enterprise environments.

Because of their self-managed features and extremely scalable modes of operation, several of the latest generation of open-source databases are also doing away with, or considerably reducing, the role of Database Administrators (DBAs).

Let's take the Cloudscape relational database management system (RDBMS that IBM recently contributed to the open-source community and compare it to the venerable open-source RDBMS workhorse, MySQL. How are they different, and if you are in the market for a no-cost fully relational database, how do those differences affect your choice?

MySQL
A multithreaded, multi-user, SQL relational database server, MySQL is open-source software available either under the GNU General Public License (GPL) or under other licenses when the GPL isn't appropriate. Unlike open-source projects such as Apache, MySQL is owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, which since 1995 has developed and maintained the product, selling support, service contracts and commercially-licensed copies of MySQL. Partly because of the multiple levels of support offered by MySQL AB, MySQL has grown into the most popular open-source database on the market.

Some of its popularity, no doubt, is due to the fact that the product is a free download for many users. But over time, MySQL's ambition level has grown to the point where some see it as a challenger to established enterprise products like Oracle and DB2. However, as the Wikipedia points out, MySQL has always lacked many properties of its big-brother commercial rivals, such as stored procedures, views and triggers. This has led some database experts, such as Chris Date and Fabian Pascal, to criticize MySQL as falling short of being a truly relational RDBMS.

Many of these criticisms of MySQL are being addressed in the latest version, MySQL 5.0, currently in beta release, but because of these and other shortcomings many developers have been reluctant to use MySQL for anything more heavy-duty than small scale Web applications.

The popularity of MySQL as a Web application is also closely tied to the popularity of PHP, an open-source scripting system used primarily for developing server-side applications and dynamic web content. MySQL and PHP are often promoted by MySQL AB and other vendors as part of the Linux, Apache, MySQL, PHP (LAMP) architecture that has become popular in the Web industry in recent years as a way of deploying inexpensive, reliable, scalable and secure web applications. (The 'P' in LAMP can also stand for Perl or Python.) Though these programs were not designed specifically to work with each other, the combination is popular because of its low cost and the ubiquity of its components (which are often bundled with many current Linux distributions).

Administering MySQL
To administer MySQL databases you have the option of using the included command-line tools, or downloadable GUI administration tools: MySQL Administrator and MySQL Query Browser. A widespread and popular alternative, written in PHP, is the open-source web application phpMyAdmin and phpMyBackupPro, also written in PHP, which can create and manage backups. It can create pseudo-cronjobs, which can be used (optionally combined with emails) to back up the MySQL database at fixed intervals. MySQL, like some of its commercial rivals, does have an ongoing administrative workload associated with it, something that is not much enjoyed by developers.

Licensing MySQL
Some users have criticized MySQL AB's position on the software licensing, since MySQL server software and the client libraries are distributed under a dual-licensing format. Users have the option of choosing either a GNU General Public License, or they may choose a commercial license. Dual-use licenses are a somewhat controversial part of the open source development world, especially since many developers also view the GNU GPL License as more restrictive than the open-source license employed by the Apache Software Foundation (ASF).

IBM's Cloudscape & ASF's Derby
Whether in the free Derby software that's available from the Apache Software Foundation, or the same codebase shipped by IBM as Cloudscape with optional paid IBM support, the small-footprint Cloudscape/Derby relational engine is making waves among open-source developers for some of its enterprise-level features and capabilities.

Like many full-blown relational enterprise databases such as IBM's DB2 and Oracle (and unlike MySQL), Cloudscape supports on-line backup and crash recovery as well as advanced features like Unicode support/internationalization, encryption, and multiple low-overhead connections. It also supports for stored procedures, functions and triggers in its current version.

Zero Administration and Stored Procedures
Unlike MySQL and the large enterprise DBMSs, Cloudscape is an 'embedded' database that can be easily hidden from the application and not require a database administrator. As an embedded DBMS, the database components are included with the application, and the server will automatically start and stop along with the execution of the application. The database server component is approximately 2MB, in a single JAR file, and does not result in application bloat. (The download, you'll notice, is around 70 MB, but that includes tools/docs and the full client/server stack for Cloudscape.) The MySQL directory for Windows, by contrast, runs 90 megs.

Cloudscape is written in Java and is very appealing for building and delivering cross-platform solutions that require a full-function RDBMS. Of course, as a Java database, it runs anywhere J2SE is available—Windows, Linux, UNIX, and the Mac OS X, for example. (MySQL runs on Linux and Windows.)

Cloudscape/Derby can be used as a client/server RDBMS as well. The Cloudscape server executes within a JVM and can easily scale to meet many database server workloads. Its database scales up to 50GB, and it easily handles processing requests of 25 concurrent connections. Cloudscape fully supports stored procedures, written in Java, to reduce network overhead and improve application scalability. (Because stored procedures contain program logic, more processing can take place on the database server, which can reduce the bandwidth consumed sending data and instructions back and forth.) Cloudscape requires very little administration as a DB server. Database storage is easily set up, and backing up data is easy using the provided tools. Cloudscape supports many of the latest SQL standards, including triggers and views.

Another important advantage of Cloudscape/Derby over MySQL is in its security encryption capabilities. Cloudscape offers the option to encrypt an entire database, which provides an extra layer of security by protecting both the file system and database schema. In other words, no data exists in clear-text form in the database files. This is especially important for remotely deployed databases or mobile databases on notebook computers that are in danger of being hacked into if the notebook computer is stolen. Surprisingly, Cloudscape/Derby database encryption adds less than 10% performance overhead, and takes no additional disk space.

Derby's Licensing Advantage
Unlike MySQL, Apache Derby can be distributed by ISV's with their applications without the ISV needing to choose between paying someone for a commercial database license, or putting their own application into open source.

Winning the Derby
With its small footprint and the fact that it's easily deployed and embedded in Java applications, the Cloudscape/Derby RDBMS is the no-brainer choice for Java developers—especially if you're on a limited budget but require the transactional capabilities of a real database.

So Cloudscape/Derby is a natural for Java developers—but it is also good for building and deploying C, Perl, or PHP applications, so the non-Java developer should also consider Cloudscape/Derby as an alternative to MySQL. The client access to Cloudscape uses the same underlying client libraries and database access protocol that is used to access DB2 UDB servers on various platforms, by the way, so if you're in a DB2 shop, you've got that added advantage..

Given that Derby is now offered as part of the Apache Software Foundation, the time may come to consider open source database alternatives to MySQL. Perhaps a new type of LAMP will result!

   
Roger Smith is the former technical editor of Software Development magazine. He has a degree in computer science and has worked for several large companies as a systems analyst and software developer for more than 15 years, using a variety of programming languages including C++, Java and UML.