Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

connet to mysql on local machine and remote machine

Posted on 2007-04-10
4
Medium Priority
?
160 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 2000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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

610 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