http://qs1969.pair.com?node_id=149443

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

I come before you with great confusion and a few less clumps of hair..... When I use DBI:mSQL, I can connect to the mSQL db. But when I try to connect to the MySQL db and use DBI:mysql, the error log keeps giving me:
install_driver(mysql) failed: Can't find loadable object for module DB +D::mysql in @INC (/usr/libdata/perl5/DBD/ /usr/libdata/perl5/i386-bsd +os/5.00402 /usr/libdata/perl5 /usr/libdata/perl5/site_perl/i386-bsdos + /usr/libdata/perl5/site_perl /usr/libdata/perl5/site_perl/i386-bsdos +/include .) at (eval 1) line 2 Perhaps DBD::mysql was statically linked into a new perl binary. In which case you need to use that new perl binary. Or perhaps only the .pm file was installed but not the shared object f +ile.
Do I have to change some link somewhere? I even tried using: use lib '/path/to/DBD' thanks for your time- (help me save my hair ;)

Replies are listed 'Best First'.
Re: fickle DBI
by strat (Canon) on Mar 05, 2002 at 17:47 UTC
    Maybe the driver DBD::mysql is not installed; try to reinstall it

    Activestate: ppm install DBD::mysql Gnuperl: perl -MCPAN -e shell install DBD::mysql

    Best regards,
    perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

      Just in case this helps, the mSQL and MySQL drivers are very different.
      thank you for your reply! using perl -MCPAN -e shell install DBD::mysql this will NOT mess up the current DBD module right? (the one that the legacy database and scripts are still using). I typed it and CPAN started asking me to make directories and such - just kinda made me nervous that I dont fark up the server
Re: fickle DBI
by trs80 (Priest) on Mar 05, 2002 at 20:39 UTC
    The other replies are partially correct. To install DBD::mysql with CPAN on any platform you have to have a C compiler. DBD::mysql links into at least 3 different libaries that are created during a mysql build. The same module is developed to work with BOTH mSQL and MySQL, but you need to specify at build time which databases you will be accessing so it builds the correct drivers.

    Don't fear the build process, but you should backup your old drivers because that is "the smart thing to do". If you have installed a new version of MySQL and are using an older DBD::mysql it is possible that the libs have been updated and your DBD::mysql file can't be loaded.

    Most of the problems encountered in the build have been discussed here: mailing list
      --Don't fear the build process, but you should backup your old drivers because that is "the smart thing to do". If you have installed a new version of MySQL and are using an older DBD::mysql it is possible that the libs have been updated and your DBD::mysql file can't be loaded. -- ah ha!! this is what i kinda suspect. the DBD::mysql is from 1997! and mysql was installed in 2000 (we're a bit behind the time i wager) . i really wish the admin would give a damn. thanks for the mailing list link!!
Re: fickle DBI
by fuzzyping (Chaplain) on Mar 05, 2002 at 18:30 UTC
    The DBI module is a database-independent interface. It still requires you to install a separate database driver. If you were to draw it, I think it would look something like this...

    Perl <--> DBI <--> dbd-mysql <--> Mysql DB

    Follow the instructions strat has listed above, and you should be A-OK. Hope this clears things up!

    -fuzzyping