Databases for Free
As I mentioned earlier, there are many choices for relational databases. For the article, I confine my discussion to two: MySQL and PostgreSQL. A web search will reveal many others, including mSQL and InterBase. MySQL and PostgreSQL, however, are the primary contenders in this area.
MySQL is the more compact of the two choices, and its claim to fame is rapid read access. For that reason, MySQL has become very popular with web server applications where many reads and few writes are the norm.
MySQL has two shortcomings. First, because of a rather primitive locking scheme, as the number of writes increases, performance drops substantially. Second, MySQL did not support transactions until the current version, 3.23. This support, by the way, uses the capabilities of the Berkeley DB software from Sleepycat.
Interfaces are available for most programming languages. Many Linux distributions include MySQL, or you can go to http://www.mysql.com/ for the latest version. As of June 2000, MySQL has been available under the GNU Public License.
PostgreSQL is the most advanced open-source database system. It grew out of Dr. Michael Stonebraker's Postgres project at the University of California at Berkeley. PostgreSQL replaced the QUEL query language of Postgres with the more common (and standard) SQL.
Discussion of the advanced capabilities of PostgreSQL could easily be an article and, more likely, a complete book. Rather than try to document all of its features, let me list some of the highlights. If the previously discussed solutions don't offer all you need for your system and this list sparks your interest, you can find more information and the software itself at http://www.postgresql.org/.
Triggers--the ability to execute server-side functions for each modified row in a table.
Temporary tables--tables that exist only for the duration of a database session.
Foreign keys--the ability to constrain values in a column based on columns in other tables.
Like other databases, there are interfaces to PostgreSQL for most programming languages. Server-side functions (which extend PostgreSQL) can be written in SQL, PL/PSQL, PL/TCL, PL/Perl and C.
If your embedded application needs to store tabular data, you are talking about a database. Everything from a flat file to a relational database is on the table. When shopping for the right answer, there is more to consider than code size and reliability. In particular, think about support issues. Working with flat files is very easy, as is using the Berkeley DB routines. On the other hand, using a relational database such as MySQL or PostgreSQL introduces a lot of new code into your system, a new language and a reasonable investment of time in the role of a database administrator.
When you are developing your application, select or design an interface to the database that is flexible. In other words, make sure all the code that offers the actual interface to the database you select is small and self-contained. That way, the replacement of one database with another will not mean a major rewrite of your entire system.
Sid Wentworth prefers animals to people but also sees that computers can be his friend. He has over 20 years of experience working with computers, virtually all without involvement with Microsoft products. Sid can be reached at firstname.lastname@example.org.
Webinar: 8 Signs You’re Beyond Cron
11am CDT, April 29th
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.Join us!
|Android Candy: Intercoms||Apr 23, 2015|
|"No Reboot" Kernel Patching - And Why You Should Care||Apr 22, 2015|
|Return of the Mac||Apr 20, 2015|
|DevOps: Better Than the Sum of Its Parts||Apr 20, 2015|
|Play for Me, Jarvis||Apr 16, 2015|
|Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites||Apr 15, 2015|
- Tips for Optimizing Linux Memory Usage
- "No Reboot" Kernel Patching - And Why You Should Care
- DevOps: Better Than the Sum of Its Parts
- Return of the Mac
- Android Candy: Intercoms
- Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites
- Designing Foils with XFLR5
- Non-Linux FOSS: .NET?
- Play for Me, Jarvis