サンプルソースを添付しますので、試してみて下さい。

#!/usr/local/bin/perl
$ENV{"DBI_DRIVER"} = "DB2";  # set driver in the environment
$ENV{"DBI_NAME"} = "DBNAME"; # set database name in the environment

use DBI;
use DBD::DB2::Constants;
use DBD::DB2 qw($attrib_int $attrib_char $attrib_float
                            $attrib_date $attrib_ts);

#$DBI::dbi_debug=9; # increase the debug output

$dbh = DBI->connect(’DBNAME’);
if (!defined($dbh)) { exit; }

# Note in the following sequence, that the statment contains
# no parameter markers, which makes the execution squence
# just prepare and execute
$stmt = "SELECT I_MODE_ID, LAST_YMD, LAST_HMS FROM DB2DEV.I_MODE;";
$sth = $dbh->prepare($stmt);

$sth->execute();

# $row[0] is the empno from the database and $row[1] is the
# image type.  In this case, the type will always be "gif"
while ((@row = $sth->fetchrow())) {
  # create an output file named empno.type in the current directory
  print "$row[0].$row[1]\n";
}

# close selection criteria cursor
$sth->finish();

$dbh->disconnect();

トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS