Solved

connet to mysql on local machine and remote machine

Posted on 2007-04-10
4
156 Views
Last Modified: 2010-03-05
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
Comment
Question by:anup001
  • 3
4 Comments
 

Author Comment

by:anup001
ID: 18885319
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
 

Author Comment

by:anup001
ID: 18885325
I also went to ppm and install > install DBD::Oracle and DBI is already installed i verified it
0
 
LVL 39

Accepted Solution

by:
Adam314 earned 500 total points
ID: 18886214
The first problem is a missing semicolon after use DBI.
What is the code for remote.pl
0
 

Author Comment

by:anup001
ID: 18886365
Nevermijd, I got it working. It was a installation problem.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question