Rate this page

Connect to a database using Perl DBI


To establish a connection to a SQL database using the Perl DBI module


The DBI module is an abstraction mechanism by which a Perl script can interact with a database with minimal regard for which DBMS (such as PostgreSQL or MySQL) is being used.

In order to use a particular database it is first necessary to connect to it. This gives you a connection handle which is needed when calling other DBI functions.


The method for connecting to a database is partially standardised, but the details depend on the DBMS in question. For further information see:

See also

Tags: perl | sql