by chalancito » 03. January 2021 02:11
ok, after trying a script of my own i got many errors, then i went to the basics and got an example from internet.
First I got an error:
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC...
then i found a tip about adding a use lib with the route to the DBD/mysql and got this error:
install_driver(mysql) failed: Attempt to reload DBD/mysql.pm aborted. Compilation failed in require at (eval 15) line 3. at /opt/lampp/htdocs/dummy2/ejbdcon1.pl line 15.
the script i try to get working is just this:
#!/usr/bin/perl
use strict;
use warnings;
use lib '/usr/lib/x86_64-linux-gnu/perl5/5.30/';
use DBI;
print "Perl MySQL Connect Demo\n";
# MySQL database configuration
my $dsn = "DBI:mysql:bd_nfl";
my $username = "root";
my $password = '';
# connect to MySQL database
my %attr = ( PrintError=>0, RaiseError=>1);
# turn off error reporting via warn()
# turn on error reporting via die()
my $dbh = DBI->connect($dsn,$username,$password, \%attr);
print "Connected to the MySQL database.\n";
I don't know now how to go ahead, your tips will be appreciated