Hi there,
Im new to perl.
Ive manged to install perl and some modules... i want to create a connection to mysql.
Ive install DBI and DBD-Mysql
However when i try to run the below script:
#!/perl/bin/perl
use Mysql;
$database = 'sphider_db';
$user = 'root';
$password = '';
$dbh = Mysql->connect(undef, $database, $user, $password);
$dbh = Mysql->connect($host, $database, $user, $password);
It comes up with the error:
Undefined subroutine &DBD::mysql::constant called at C:/Perl/site/lib/Mysql.pm line 236.
Compilation failed in require at C:\Documents and Settings\Lee Nash\Desktop\GAF Projects\Betting\Perl\databasemysql.pl line 3.
BEGIN failed--compilation aborted at C:\Documents and Settings\Lee Nash\Desktop\GAF Projects\Betting\Perl\databasemysql.pl line 3.
I dont understand what this means...
Any ideas?
ive also tried to use DBI in the below script:
use DBI;
# connect
my $dbh = DBI->connect("dbi:mysql:sphider_db:localhost:3306", "root", "");
however this comes up with the error:
Can't locate object method "connect" via package "DBI" (perhaps you forgot to load "DBI"?) at C:\Documents and Settings\Lee Nash\Desktop\GAF Projects\Betting\Perl\databaseaccess.pl line 6.
So irritating!!
Im pretty sure ive installed DBI correctly.. how do i check that its installed correctly?
Kind regards
Nash
Im new to perl.
Ive manged to install perl and some modules... i want to create a connection to mysql.
Ive install DBI and DBD-Mysql
However when i try to run the below script:
#!/perl/bin/perl
use Mysql;
$database = 'sphider_db';
$user = 'root';
$password = '';
$dbh = Mysql->connect(undef, $database, $user, $password);
$dbh = Mysql->connect($host, $database, $user, $password);
It comes up with the error:
Undefined subroutine &DBD::mysql::constant called at C:/Perl/site/lib/Mysql.pm line 236.
Compilation failed in require at C:\Documents and Settings\Lee Nash\Desktop\GAF Projects\Betting\Perl\databasemysql.pl line 3.
BEGIN failed--compilation aborted at C:\Documents and Settings\Lee Nash\Desktop\GAF Projects\Betting\Perl\databasemysql.pl line 3.
I dont understand what this means...
Any ideas?
ive also tried to use DBI in the below script:
use DBI;
# connect
my $dbh = DBI->connect("dbi:mysql:sphider_db:localhost:3306", "root", "");
however this comes up with the error:
Can't locate object method "connect" via package "DBI" (perhaps you forgot to load "DBI"?) at C:\Documents and Settings\Lee Nash\Desktop\GAF Projects\Betting\Perl\databaseaccess.pl line 6.
So irritating!!
Im pretty sure ive installed DBI correctly.. how do i check that its installed correctly?
Kind regards
Nash