##
my $dbh = DBD->connect('DBD:ODBC:japmysql','','')
## ##
my $dbh = DBI->connect('DBI:ODBC:japmysql','','')
####
#!C:/Perl/bin/perl
use DBI;
use DBD::mysql;
use CGI qw/:standard :html3/;
use CGI::Carp qw(fatalsToBrowser);
my $query = CGI -> new;
use Encode "encode";
sub U2Entity {
return ''.unpack("H*", encode("ucs2be", shift)).';';
}
sub Any2Hex {
return unpack("H*", shift);
}
print header(-charset=>'utf-8');
print "\n";
my $dbh = DBI->connect('DBI:ODBC:japmysql','','', {mysql_enable_utf8=>1}) or die "Cannot connect: $DBI::errstr\n";
$dbh->{mysql_enable_utf8} or die "couldn't init mysql_enable_utf8";
my $sth = $dbh->prepare('Select English, Kana, Kanji from Vocab')
or die("Couldn't prepare");
$sth->execute or die ("Could not execute SQL statement.");
if($sth->rows == 0)
{
print "No information.";
}
else
{
print "\n";
while( $resptr = $sth->fetchrow_hashref() )
{
print "";
print "" . $resptr->{"English"};
print " " . $resptr->{"Kana"};
print " " . $resptr->{"Kanji"};
print "\n";
}
print "
\n";
}
print "\n";
$dbh->disconnect;
####
$dbh->{mysql_enable_utf8} or die "couldn't init mysql_enable_utf8";