You are here

A NuoDB Driver for Perl

Even though newer scripting languages are now in vogue, Perl is still the workhorse of the internet. The job market for Perl developers is going strong and Perl has a long history of use in major web sites such as Ticketmaster, Booking.com and The New York Times. Perl is well suited for database processing tasks due to the mature, unified DBI database interface and the numerous database-related modules, templating solutions and ORM frameworks available from the CPAN repository.

NuoDB provides a truly scalable, cloud database that is SQL-compatible at the same time. By connecting to NuoDB, legacy database applications can continue to run and scale into the cloud era while taking advantage of automatic redundancy and easier management.

An experimental NuoDB DBI driver is now available from GitHub. It provides enough functionality to run actual queries and real Perl applications against NuoDB.

To obtain and install the driver:

git clone git://github.com/nuodb/perl-dbd-nuodb.git
cd perl-dbd-nuodb
perl Makefile.PL --nuodb-libs=/opt/nuodb/lib64 --nuodb-includes=/opt/nuodb/include
make
sudo make install

A HelloDB script would look like this:

use strict;
use DBI;
my $dbh = DBI->connect('dbi:NuoDB:test@localhost', 'username', 'password');
my $sth = $dbh->prepare("SELECT 'HelloDB' FROM DUAL");
$sth->execute();
my @data = $sth->fetchrow_array();
print $data[0];
$sth->finish();
$dbh->disconnect();

Internally, we use the driver to run the open-source Random Query Generator testing tool against NuoDB. Originally it was created to test MySQL, but the availability of a Perl driver for NuoDB allowed for the tool to be quickly retargeted to NuoDB, producing immediate benefits to product quality.

Add new comment