• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

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=$database";
  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
0
anup001
Asked:
anup001
  • 3
1 Solution
 
anup001Author Commented:
when i try to connect remotely i get the folowing error

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.
0
 
anup001Author Commented:
I also went to ppm and install > install DBD::Oracle and DBI is already installed i verified it
0
 
Adam314Commented:
The first problem is a missing semicolon after use DBI.
What is the code for remote.pl
0
 
anup001Author Commented:
Nevermijd, I got it working. It was a installation problem.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now