Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    1

    Unanswered: 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

  2. #2
    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

  3. #3
    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.

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •