|
i did comment the line -- "use DBD::mysql;" -- at
first. when executed, the error is:
install_driver(mysql) failed:
Can't load module DBD::mysql, dynamic loading not available in this
perl. (You may need to build a new perl
executable which either supports dynamic
loading or has the DBD::mysql module statically linked into
it.) at (eval 1) line 3
Compilation failed in require at (eval 1) line 3.
so i added this line to statically link DBD::mysql
module.
thanks
-------Original Message-------
Date: 2002��04��15��
10:24:03
Subject: RE: question
about DBI
Hi Xu, Yilin, you asked about a script that
complained:
> Undefined subroutine &DBI::dr::connect called
at > /usr/lib/perl5/site_perl/5.6.0/i386-linux/DBI.pm line
471.
I think the explicit use of DBD::mysql is causing the problem.
I don't have a mysql installed, but try commenting out that use
line as follows and see if the program works:
#! /usr/bin/perl
-w use strict; use DBI; # ----- # remove this line # use
DBD::mysql; # ----- my $dbusername = 'test'; my $dbpassword =
'test'; my $sql; my $dbh; my $dbname = 'test'; $dbh =
DBI->connect('DBI:mysql:'.$dbname, $dbusername, $dbpassword) || die
"$DBI::errstr\n"; $sql = $dbh->prepare("INSERT INTO testac VALUES
(11,
'youknow')"); $sql->execute; $dbh->disconnect();
Good
luck.
Stph
. |