mysql perl connection problem
i have installed perl in windows.
When i execute the following code:
#!/usr/bin/perl
# PERL MODULE
use DBD::Mysql;
# HTTP HEADER
print "Content-type: text/html \n\n";
# CONFIG VARIABLES
$host = "127.0.0.1";
$database = "shah569";
$user = "jmlnsr";
$pw = "ntr562";
# PERL MYSQL CONNECT
$connect = Mysql->connect($host, $database, $user, $pw);
print 'Hello';
I get following error in apache error log.
Can't locate object method "connect" via package "Mysql" (perhaps you forgot to
load "Mysql"
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules [at] m .gmane.org
AW: mysql perl connection problem
> -----Ursprüngliche Nachricht-----
> Von: Jamal Nasir [mailto:mjamal_nasir [at] yahoo.com]
> Gesendet: Dienstag, 27. Juli 2010 15:52
> i have installed perl in windows.
> When i execute the following code:
>
> #!/usr/bin/perl
>
> # PERL MODULE
>
> use DBD::Mysql;
>
> # HTTP HEADER
> print "Content-type: text/html \n\n";
>
> # CONFIG VARIABLES
> $host =3D "127.0.0.1";
> $database =3D "shah569";
>
> $user =3D "jmlnsr";
> $pw =3D "ntr562";
>
> # PERL MYSQL CONNECT
> $connect =3D Mysql->connect($host, $database, $user, $pw);
> print 'Hello';
>
> I get following error in apache error log.
>
>
> Can't locate object method "connect" via package "Mysql"
> (perhaps you forgot to
> load "Mysql"
As the documentation for DBD::mysql points out (right at the start), the =
way to use DBI and, in particular, the MySQL driver is this:
use DBI;
$dsn =3D =
"DBI:mysql:database=3D$database;host=3D$hostname;port=3D$por t";
$dbh =3D DBI->connect($dsn, $user, $password);
\Gisbert
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules [at] m.gmane.org