Having problem on DBD::mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andreslee8
    New Member
    • Apr 2012
    • 1

    Having problem on DBD::mysql

    Hi,

    I have a problem on connect to MYSQL database.
    Below is my code:

    Code:
    use strict;
    use warnings;
    use DBI;
    my $dbh = DBI->connect('DBI:mysql:MYDB', 'andres', '123'
    	           ) || die "Could not connect to database: $DBI::errstr";
    
    $dbh->disconnect();
    When i execute my perl file, it show out:

    install_driver( mysql) failed: Can't locate loadable object for module DBD::mysql in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at (eval 5) line 3
    Compilation failed in require at (eval 5) line 3.
    Perhaps a module that DBD::mysql requires hasn't been fully installed at insertdata.pl line 6

    I have put the DBD library in c:\Perl\lib\DBD and c:\perl\site\li b\DBD , but i the problem still persist.

    The weird things that i found out whenever i run then "ppm install DBD::mysql" but it always time out.

    Any one can help me on this? Thanks in advance.,,
    Last edited by numberwhun; May 1 '12, 05:37 AM. Reason: Please use code tags!
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    What is funny is DBD::mysql is usually installed with Perl by default. What version of Perl are you using? I am assuming Active State since you mentioned ppm.

    Have you tried using Strawberry Perl if your on Windows?

    Regards,

    Jeff

    Comment

    • RonB
      Recognized Expert Contributor
      • Jun 2009
      • 589

      #3
      This error:
      install_driver( mysql) failed: Can't locate loadable object for module DBD::mysql
      Along with this:
      I have put the DBD library in c:\Perl\lib\DBD and c:\perl\site\li b\DBD
      tells me that you didn't install the module correctly.

      What error message do you get when you try to install it via ppm?

      Comment

      Working...