DB2 10.5 for Linux, UNIX, and Windows

Running Perl sample programs

Perl sample programs demonstrate how to connect and run database operations with the IBM® database server..

Before you begin

Before running the Perl sample programs, you must install the latest DBD::DB2 driver for Perl DBI. For information about how to obtain the latest driver, see http://search.cpan.org/~ibmtordb2/.

About this task

The Perl sample programs for DB2® database are available in the sqllib/samples/perl directory.

Procedure

To run a Perl sample program through the Perl interpreter:

Enter the interpreter name and the program name (including the file extension): Some of the sample programs require you to run support files. For example, the tbsel sample program requires several tables that are created by the tbselcreate.db2 CLP script. The tbselinit script (UNIX), or the tbselinit.bat batch file (Windows), first calls tbseldrop.db2 to drop the tables if they exist, and then calls tbselcreate.db2 to create them. Therefore, to run the tbsel sample program, issue the listed commands:
Note: For a remote client, you must modify the connect statement in the tbselinit or tbselinit.bat file to hardcode your user ID and password: db2 connect to sample user <userid> using <password>