#!/usr/bin/perl -- use strict; use DBI; our $DB_NAME = "perldb"; our $DB_USER = "hoge"; our $DB_PASS = "hogehoge"; our $DB_HOST = "localhost"; our $DB_PORT = "3306"; my $dbh = DBI->connect("dbi:mysql:dbname=$DB_NAME;host=$DB_HOST;port=$DB_PORT","$DB_USER","$DB_PASS") or die "$!\n Error: failed to connect to DB.\n"; my $sth = $dbh->prepare("SELECT * FROM t1;"); $sth->execute(); print "Content-Type: text/html; charset=Shift_JIS\n\n"; while (my $ary_ref = $sth->fetchrow_arrayref) { print "<p>$ary_ref->[0], $ary_ref->[1]</p>\n"; } $sth->finish; $dbh->discconect;
なんや、OKだ。
次は、このままec2にperlを載せたい。