Solved

connet to mysql on local machine and remote machine

Posted on 2007-04-10
4
153 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now