anup001
asked on
connet to mysql on local machine and remote machine
I am trying to connect to mysql on local machine with the follow script but i am getting the error as
C:\>perl test.pl
syntax error at test.pl line 4, near "use DBI
use strict"
Execution of test.pl aborted due to compilation errors.
use DBI
use strict;
my $driver = "mysql";
my $database = "employees";
my $dsn = "DBI:$driver:database=$dat abase";
my $userid = "root";
my $password = "password";
my $dbh = DBI->connect($dsn, $userid, $password )
or die $DBI::errstr;
Also how to I modify to copnnect to a orcle database on a remote server
C:\>perl test.pl
syntax error at test.pl line 4, near "use DBI
use strict"
Execution of test.pl aborted due to compilation errors.
use DBI
use strict;
my $driver = "mysql";
my $database = "employees";
my $dsn = "DBI:$driver:database=$dat
my $userid = "root";
my $password = "password";
my $dbh = DBI->connect($dsn, $userid, $password )
or die $DBI::errstr;
Also how to I modify to copnnect to a orcle database on a remote server
ASKER
I also went to ppm and install > install DBD::Oracle and DBI is already installed i verified it
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nevermijd, I got it working. It was a installation problem.
ASKER
C:\>perl remote.pl
DBD::oracle initialisation failed: Can't locate object method "driver" via packa
ge "DBD::oracle" (perhaps you forgot to load "DBD::oracle"?) at C:/Perl/site/lib
/DBI.pm line 747.