DBI - Database Independent Interface for Perl
Database Drivers (DBDs)
- For Oracle use DBD::Oracle.
- For Microsoft SQL Server you can use either DBD::ODBC or DBD::ADO.
- For MySQL and MariaDB use DBD::mysql.
- For IBM DB2 use DBD::DB2.
- For IBM Informix use DBD::Informix.
- For SAP Sybase use DBD::Sybase.
- For PostgreSQL use DBD::Pg.
- For SQLite use DBD::SQLite.
- For Teradata you have two choices: DBD::Teradata is the older. It has a version off CPAN, but it is uncler to me if it is being maintained now. Teradata::SQL is less comprehensive and it does not work with DBI. It has a different API. The author of the latter seems to be much more responsive.
- For Daegis Inc, what was formerly called the Unify database use DBD::Unify.
- For Neo4j graph database you can use REST::Neo4p that allows for the execution of Neo4j Cypher language queries, or DBD::Neo4p which is a DBI-compliant wrapper around that module.
Generic Database Drivers (DBDs)
- DBD::ADO for Microsoft ADO (ActiveX Data Objects) (There is also a Win32::ADO module but that's not recommended.)
- DBD::ODBC to connect to any database via ODBC (Open Database Connectivity)
- Win32::ODBC solely exist for backwards compatibility. It started life in 1996 when DBD::ODBC didn't exist yet, and Perl on Windows was still a fork that couldn't build CPAN modules (it didn't even support MakeMaker). Use DBD::ODBC instead.
Special Database Drivers
There are all kinds of other Database Drivers that can be used to make data look like they are in a Relational Database.
- DBD::PO for PO (Portable Object) files used by gettext for internationalization and localization (i18n)
- DBD::CSV allows us to access CSV files. For example Calculating bank balance using DBD::CSV
- DBD::DBM for DBM and MLDBM files.
- DBD::Mock is a database driver for testing
- DBD::iPod connects DBI to an iPod
- DBD::Google to treat Google as relational database.
- DBD::Sys treat System tables as a relational database.
Not Database Drivers
There are some module in the DBD::* namespace that are not Database drivers.
- DBD::Log is a logging mechanism for DBI
Wrappers around DBI
- DBIx::Class (a.k.a. DBIC)
- Pcore::DBD works on top of the Pcore application framework.
It provides general API for:
- Connections cache for use with forks and threads.
- Query builder with support of particular db server specific syntax.
- Schema management (apply / revert changesets).
- More handy functions for fetching data (from my point of view).
See also the comprehensive list of all the DBD modules.
Other database related articles