Moving to PostgreSQL's Object-Relational DBMS
As more companies dive into open-source business systems, many are building web-to-back-end stacks that typically include Linux, PHP, Apache web server and an open-source database, usually either MySQL or PostgreSQL. PostgreSQL is gaining favor of late in many quarters, having reached, some say, a critical mass of functionality and stability. Several high-profile companies now provide 24/7 support, including Red Hat. This article shows what to expect when switching from Microsoft Access to an open-source database (in this case, BSD-style licensed PostgreSQL).
Michael Calabrese, manager of information systems for Bike Friday, recently undertook the challenge. Bike Friday is a rapidly expanding touring and mountain bike company based in Eugene, Oregon. It uses PostgreSQL to handle all of its sales, manufacturing and customer support data. Calabrese is also in the midst of changing all of the company's e-commerce systems from proprietary to open-source—Linux and Apache, with PostgreSQL at the core. For now, however, he has retained Microsoft Access 97 as the front end in order to minimize downtime while replacing the back end with PostgreSQL and adding new features. Calabrese says:
If you're not dealing with preserving an existing front end, life is easy. Just run the conversion scripts [detailed below] and start writing a new front end. If you have an Access front end that you can continue to use with a PostgreSQL back end, you've provided clear pathways for things to grow, without trying to convert the whole system at once. In the first scenario, you'd be looking at a year for the conversion after freezing the whole front end. Attacking the change incrementally allows you to start designing new things with the choice of whether to do it in Access or PostgreSQL.
Calabrese decided to move to PostgreSQL because it is the more enterprise-capable system. It has a mature transaction-management system with a sophisticated data-locking mechanism called multiversion concurrency control (MVCC), which allows read-only access to data even if it's in use.
Loading the Microsoft open database connectivity (ODBC) drivers onto the PostgreSQL template database lets Access and PostgreSQL set up house together. Besides basic conversion tools (see Resources), additional ODBC server-side functions that Access sometimes needs to run psql <database name> <odbc.sql> are located in the directory src/interfaces/odbc/odbc.sql. PostgreSQL also provides a platform-independent Type 4 Java database connectivity interface (JDBC) driver. An embedded interface for C (ECPG) is also part of PostgreSQL. Once the installation was finished, Calabrese chose data migration tools like pgAccess, available in Windows and UNIX versions, and exSQL public version 3.1.
After backing up existing databases using the included tools (either the pg_dumpall utility or a combination of the pg_dump and pg_dumpaccounts utilities) and running the Installer, the first step in the data conversion is to hunt down illegal file names in Access. Access is quite liberal in its allowance of illegal characters that other databases—Oracle, Sybase and PostgreSQL included—will not understand. Therefore, scores of illegal terms for Bike Friday's shipping and ordering data that Access thought were fine had to be converted for PostgreSQL. For example, tables like Order Detail needed to become Order_Detail or OrderDetail, and field names such as Shipped? had to become Shipped or ShippedYN.
The basic conversion tools will remove all illegal characters automatically. This can be problematic for those working with an existing front end, because the front and back ends can cease communicating without an apparent reason. Calabrese recommends that anyone planning to preserve an existing front end should not change the names containing illegal characters in the front-end data or, alternatively, make parallel changes manually. In his situation, Calabrese found himself manually changing characters one by one on Bike Friday's front and back ends, which was okay since he was going to have to change the front end anyway. Either way, it's at this point that one should perform the first of many tests to be sure everything works. With illegal character issues resolved, the data is ready for conversion.
- The Tiny Internet Project, Part I
- Machine Learning with Python
- SUSECON 2016: Where Technology Reigns Supreme
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Free Today: September Issue of Linux Journal (Retail value: $5.99)
- Bitcoin on Amazon! Sort of...
- Securing the Programmer
- Android Browser Security--What You Haven't Been Told
- The Many Paths to a Solution
Pick up any e-commerce web or mobile app today, and you’ll be holding a mashup of interconnected applications and services from a variety of different providers. For instance, when you connect to Amazon’s e-commerce app, cookies, tags and pixels that are monitored by solutions like Exact Target, BazaarVoice, Bing, Shopzilla, Liveramp and Google Tag Manager track every action you take. You’re presented with special offers and coupons based on your viewing and buying patterns. If you find something you want for your birthday, a third party manages your wish list, which you can share through multiple social- media outlets or email to a friend. When you select something to buy, you find yourself presented with similar items as kind suggestions. And when you finally check out, you’re offered the ability to pay with promo codes, gifts cards, PayPal or a variety of credit cards.Get the Guide