http://www.perlmonks.org?node_id=690929

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi I am trying to use DBI on win32,

it gives me following error:

install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC +contains: C:\bla\bla\Desktop\ C:/Perl/site/lib C:/Perl/lib .) at (eval 4) line 3 +. Perhaps the DBD::mysql perl module hasn't been fully installed, or perhaps the capitalisation of 'mysql' isn't right. Available drivers: CSV, DBM, ExampleP, File, Gofer, ODBC, Oracle, Prox +y, SQLite, Sponge, mysqlPP.

I have installled DBI and DBD using ppm Tk. I can see those foleders DBI,DBD,SQL in the perl\site\bin

what could be the problem?

I am using mySQL server form Sun.

Please help me.

Replies are listed 'Best First'.
Re: DBI not installed
by bart (Canon) on Jun 08, 2008 at 16:44 UTC
    Even though moritz did a fine job telling you what your problem is, you seem not to understand what he's saying. So Let me try again.

    Despite your node title, DBI itself appears to be installed fine. DBI is the root module for database support. In fact, it's DBI that is giving you the message of which drivers are installed.

    Now, there are a lot of database drivers for DBI, and they're all classified under the common prefix DBD. That is DBD, with a "D", not with an "I".

    You do have several drivers, including one for Oracle, one for SQLite and even DBD::mysqlPP, which is a Pure Perl driver for Mysql. Maybe that's the one you installed by accident? And that is why you can see a "DBD" folder: that's where all those DBD drivers are installed.

    Now, one that is missing, is the normal driver for Mysql, and that is DBD::mysql. Notice the case. I'm quite certain that if you try to install that, and pick the correct one this time, it'll work.

    BTW you do have the Mysql client software on your PC, I hope? Things might not install properly if you don't have it. I think DBD::mysql depends on a DLL in that package.

      Hello Bart, when I used >ppm install DBD::mysql this is the message that iI got: Downloading ActiveState Package Repository packlist...not modified.No missing packages to install. What do you think it is? I know what modules I want and I'm pretty much aware of what I installed,and wondering why it's not working?
        Downloading ActiveState Package Repository packlist...not modified.No missing packages to install.

        Yes, I get the same (and DBD::mysql does not get installed).

        Seems that ActiveState don't have a ppm for DBD::mysql, so you'll need to grab it from one of the other repositories - eg, for perl 5.10:
        ppm install http://cpan.uwinnipeg.ca/PPMPackages/10xx/DBD-mysql.ppd
        or for perl 5.8:
        ppm install http://theoryx5.uwinnipeg.ca/ppms/DBD-mysql.ppd
        Cheers,
        Rob
Re: DBI not installed
by moritz (Cardinal) on Jun 08, 2008 at 15:22 UTC
    You also need to install DBD::mysql (or use mysqlPP instead in your DSN, but I'd recommend DBD::mysql if you've got a chance to install it).
      I have installed DBI::mysql at cpan control as well as using ppm. Still i get the same error. why is it? Can you give me any directions to check.
        DBI can't find your DBD::mysql module. Can your normal perl find it?

        You can check it by executing this line:

        perl -MDBD::mysql -e1

        If there is no output, the module is installed just fine, and I have non clue why DBI doesn't find it. If there is some noisy output about not being able to load DBD/mysql.pm, your module installation is broken.