Printable Version
 Updates

 Documentation

 Support & Training

 Community
  Online Forum
  Newsgroups
Database connection in Perl

Products:   
Areas: Perl 

In order to facilitate database connection when using the Perl language, you have
to install additional packages that implement the database connectivity. Depending
on the Perl distribution you are using, there are different ways of installing
packages. There are also a number of publicly accessible sites where the packages
can be downloaded from. These include:

http://www.indigostar.com/packages/perl5_6/
http://www.perl.com/CPAN-local/README.html
http://www.activestate.com//PPMPackages/5.6
http://dada.perl.it/PPM

If you have the IndigoStar distribution of Perl, you can use the GUI package manager
to automatically download and install packages. For the ActivateState distribution, you can run
the PPM.bat file from a command prompt and use it to browse, download and install packages.
For other distributions, please consult the documentation that accompanies the software.

The packages required for database connectivity are:

1. The database Interface called DBI.

2. A database driver for the specific database you are using. The name of the
drivers is usually of the form DBD:database_name, where database_name
is the name of the database concerned.


For instance, if your database of choice is MySQL, you would need to have the
DBI package as well as DBD:MySQL. Similarly, to connect to an ODBC data source,
you would need the DBD:ODBC package in addition to the DBI package.
Note that the DBI package needs to be installed only once, after which you
can incrementally install the DBD packages for the databases you use.

Within CodeCharge Studio, setting up the Server side database connection is
pretty straight forward. To begin with, note that the design time connection
does not use the DBI or DBD packages but rather can be configured to connect
directly to the database using OLE DB or ODBC. It is only the server side connection
that uses DBI.


The connection string used for the server side connection is of the form:

DBI:database_driver_name:database_name

e.g DBI:MySQL:MySQLDB or DBI:ODBC:AccessDatabase


Viewed 12770 times.   Last updated: 12/30/2002 5:17:05 PM