If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > How to connect the mysql to perl script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-24-09, 04:23
deepagowda deepagowda is offline
Registered User
 
Join Date: Feb 2009
Posts: 1
How to connect the mysql to perl script

Hi,


Please can any one tell me how to connect the mysql to perl script becoz am using the active perl with mysql . pls try to give the correct command.


Thanks
Deepa
Reply With Quote
  #2 (permalink)  
Old 11-14-09, 09:53
mtravel13 mtravel13 is offline
Registered User
 
Join Date: Nov 2009
Posts: 5
perlmysqlconnect.pl:

#!/usr/bin/perl

# PERL MODULE
use Mysql;

# HTTP HEADER
print "Content-type: text/html \n\n";

# CONFIG VARIABLES
$host = "localhost";
$database = "store";
$tablename = "inventory";
$user = "username";
$pw = "password";

# PERL MYSQL CONNECT
$connect = Mysql->connect($host, $database, $user, $pw);

that was on the tutorial , just google for more info
Reply With Quote
  #3 (permalink)  
Old 12-04-09, 10:05
scooby_at_work scooby_at_work is offline
Registered User
 
Join Date: Sep 2009
Posts: 44
I'd strongly recommend using DBI along with DBD::mysql. Example of connecting here.

The Mysql module is an obsolete interface and you should not use it in new code. Source.

Quote:
that was on the tutorial , just google for more info
This is the danger of just copying and pasting random crap off the web. CPAN (which I linked to above) always has the latest versions of modules and has the documentation straight from the authors. Why would you grab a random tutorial when the subject matter experts, the guys who wrote the module have the latest and greatest right in the docs?

I mean, aside from laziness.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On