Preparing to Use the SQLite Interface


To access a SQLite database from Perl you need to install both the DBI module and the DBD module for SQLite.

If you do not already have DBI installed, use cpan to download it from the Comprehensive Perl Archive Network and install it.

 # cpan cpan> install DBI 

On Windows platforms using the ActivePerl distribution, use the ppm.bat script to install Perl modules.

 C:\perl\bin> ppm.bat ppm> install DBI 

Note that it can take a while to download, configure, compile, and install CPAN modules. If you are accessing CPAN for the first time, a set of modules will also be downloaded first to update your system.

To add the SQLite DBD module to your system, install DBD::SQLite2 from CPAN.

 # cpan cpan> install DBD::SQLite2 

The DBD::SQLite2 package includes as much of SQLite as it needs, so there is no need to have the SQLite libraries on your system before installing the DBD moduleyou can add SQLite support to Perl on a fresh system without needing to download anything from sqlite.org, although you will probably want to install the sqlite monitor tool too.

Note

As we have chosen to stick with the existing, stable, and well-supported SQLite 2 engine throughout this book, you should install DBD::SQLite2 for a compatible Perl database driver. The original DBD::SQLite module uses the latest SQLite libraryversion 3which uses a different database file format than the previous version.

Though the Perl DBI abstracts the actual database back end and the examples in this chapter will work with whatever SQLite version you use, you also need to be using the appropriate sqlite tool for your SQLite library version in order to read your databases. You can read about the changes in SQLite 3 in Appendix I, "The Future of SQLite."




    SQLite
    SQLite
    ISBN: 067232685X
    EAN: 2147483647
    Year: 2004
    Pages: 118
    Authors: Chris Newman

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net