Solved

connet to mysql on local machine and remote machine

Posted on 2007-04-10
4
158 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
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…
Six Sigma Control Plans

690 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