Home arrow Perl Programming arrow Perl and DBI

Perl and DBI

Databases are a mission-critical part of any company's resources. If you program in Perl, you'll want to learn about the DBI, which can help you connect to many popular databases. This article, the first part of a series, is excerpted from chapter 15 of the book Beginning Perl (Apress; ISBN: 159059391X).

  1. Perl and DBI
  2. Introduction to Relational Databases
  3. The Relational of Relational Database
  4. We Need an SQL Server—MySQL
By: Apress Publishing
Rating: starstarstarstarstar / 2
March 14, 2008

print this article



It is now time to talk about one of Perl’s best modules: the Database Independent (DBI) module.DBIprovides an easy-to-use and portable (both across operating systems and across databases) application programming interface (API) that allows us to connect to a wide variety of databases including Oracle, Sybase, Informix, MySQL, mSQL, Postgress, ODBC, and many others, even files with comma-separated values (CSV). With this module we can access and administer databases from our Perl programs, combining the power and enjoyment of Perl with the usefulness of databasing information.

In this chapter we will introduce the concept of SQL and discuss the most common ways to use it. Then we will discussDBIand the relatedDBD(Database Driver) modules. We will then write some Perl code to access and update a MySQL database. Finally, we will take our newfound knowledge and connect it with our topic from the last chapter and create a simple web interface to a database by combining Perl,DBIand CGI. This sounds like fun, so let’s get to it.

Structured Query Language (SQL, pronounced as “EssQueueEl” by most and “Sequel” by some) is a language allowing a programmer access to a relational database. It is relatively easy to use—compared to Perl, learning SQL is a snap. We will talk about some of the most common SQL queries, or commands that access a database, and in talking about them we will describe the language to the point that learning the remaining details will be simply a matter of referring to an SQL book or website.

But we are getting ahead of ourselves. Before we can talk about SQL we need to discuss relational databases.

>>> More Perl Programming Articles          >>> More By Apress Publishing

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Perl Turns 25
- Lists and Arguments in Perl
- Variables and Arguments in Perl
- Understanding Scope and Packages in Perl
- Arguments and Return Values in Perl
- Invoking Perl Subroutines and Functions
- Subroutines and Functions in Perl
- Perl Basics: Writing and Debugging Programs
- Structure and Statements in Perl
- First Steps in Perl
- Completing Regular Expression Basics
- Modifiers, Boundaries, and Regular Expressio...
- Quantifiers and Other Regular Expression Bas...
- Parsing and Regular Expression Basics
- Hash Functions

Developer Shed Affiliates


Dev Shed Tutorial Topics: