Saturday, January 08, 2005

About MySQL, Java, and good Prototypes

Over the holiday period at work most of my team was on vacation. Thus, I was left to "special projects". My group and I decided that a good project-prototype would be a SQL/RDBMS backed complete re-working of an existing form on our website. By form - imagine a form with about 20 complex fields for working with a command-line based back-end legacy system.

The goals of the prototype were simple:
Allow users of a complex app to save their form inputs in named templates.
Allow users to retrieve templates at any time, with an easy/natural UI.
Get this done - including installing MySQL & learning it's quirks in less than 4 days.

I have to say: the OSS community rocked. Soo many people out there using MySQL posted tutorials & FAQs on MySQL <-> Java usage, that rarely was I stuck on a problem. The only thing that got me - more of a Java issue, was that I had an old javax(?)-naming.jar in our web application lib dir (from when it was on JServ) that broke the more recent JNDI naming in Tomcat. Once I removed the outdated ...-naming.jar file, everything fell into place.

Having used JDBC (the java API for database connectivity) I was no stranger to the issues of using an RDBMS concurrently for the many simultaneous users of a web application. I started looking for a database/resource connection-pool and it was immediately clear: Apache-Tomcat includes a very robust connection pool! That was one of the only things I was about to miss from using WebLogic. So - after setting up the Jakarta-Commons based database connection pool (DBCP), I was ready to begin on my code.

In just a few hours, I had a basic schema, users, and a FREE tool for schema mgmt, backups, and general MySQL Admin. The tool I use is SQLYog. These guys realized that they'd never compete with the free tools (php-MySQL) if they didn't have a free 'lite' version. So, with this great windows-UI based tool installed and a few hours work, I was up and running - even with nice printouts of my schema (and html to email around).

To wrap it up - this article is intended to give confidence to anyone considering MySQL as a back-end for any Java project, not necessarily a web based one. The driver works well and the documentation is fantastic. In less time than purchasing and our IT-Unix Support group could have installed any of the non-free/OSS RDBMS systems, I had a fully working prototype ready to show-off. It was good enough, that it's now commissioned into a full project that will include upgrading a few other features and polishing the UI to work in both standalone (IE/FF) browsers as well as PDA browsers such as those in RIM devices.

MySQL + Java + Rapid Development = Success.

No comments: