mysql perl connection problem

mysql perl connection problem

am 27.07.2010 15:52:27 von m jamal

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@m .gmane.org

AW: mysql perl connection problem

am 27.07.2010 16:28:24 von Gisbert.Selke

> -----Ursprüngliche Nachricht-----
> Von: Jamal Nasir [mailto:mjamal_nasir@yahoo.com]=20
> Gesendet: Dienstag, 27. Juli 2010 15:52
> i have installed perl in windows.
> When i execute the following code:
>=20
> #!/usr/bin/perl
>=20
> # PERL MODULE
>=20
> use DBD::Mysql;
>=20
> # HTTP HEADER
> print "Content-type: text/html \n\n";
>=20
> # CONFIG VARIABLES
> $host =3D "127.0.0.1";
> $database =3D "shah569";
>=20
> $user =3D "jmlnsr";
> $pw =3D "ntr562";
>=20
> # PERL MYSQL CONNECT
> $connect =3D Mysql->connect($host, $database, $user, $pw);
> print 'Hello';
>=20
> I get following error in apache error log.
>=20
>=20
> Can't locate object method "connect" via package "Mysql"=20
> (perhaps you forgot to=20
> 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 @m.gmane.org