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

OK, this is going to seem trivial and I am sure it is. However so many of you have helped me in the past.
I have been using Perl 5.8.0 for doing various project for about 6 months now and the majority of these projects include doing datbase work with DBI and Oracle. I have the connection strings for this and have had no problem. The problem now is I am trying to learn DBI:MySQL and start using MySQL for my own projects. Lo and behold it is failing at the connection string. At least I think it is. I get a messagebox from Windows (Argh!! Damn you Bill!!) saying "This application failed to start because PERL56.DLL was not found. Please try reinstalling this application."
Now, I have been using 5.8.0 and do not even have 5.6 that I am aware of. I also get a message from PERL saying "Perhaps a required shared library or DLL is not installed where expected at Line 6."
Fair enough. I have tried installing DBI and MySQL driver again and again. I have read on CPAN how to call the driver but this smacks of something slightly different. I am sure the answer is quite close and just out of grasp. My mind is weak this morning from Matrix aftermath. Please if any monk has a clue or koan that leads me in correct direction I will gladly take it.
Also I know this connection string is likely wrong now as I mucked with it so many ways. This is fine, but I am including some code so you may see what I am doing. It is extremely simple compared to what I have been doing.
Please no laughing. I am including only relevant parts of the code.
use DBI; my ($dbh, $sth, $count); $dbh = DBI->connect ("DBI:mysql:database=webdb;host=localhost", "webdev"," ", {PrintError=>0, RaiseError=>1});

As usual. Thank you all for your wonderful help.

Akira

Replies are listed 'Best First'.
Re: DBI, Windows and Perl56.dll error
by dws (Chancellor) on May 15, 2003 at 15:59 UTC
    Please if any monk has a clue or koan that leads me in correct direction I will gladly take it.

    You're running 5.8 on Windows, but you also suggest that you're getting the MySQL driver from CPAN. Have you tried getting the pre-built driver from ActiveState? Assuming that you're running ActiveState Perl,

    C:> ppm install dbd-mysql
    is the incantation to fetch the mysql driver from the ActiveState repository and install it.

      Thank you for your reply.

      I did try this before and I have run a test of DBI to see if it works. I forgot to emntion this. First here is the output from DOS that I received when doing the above code just to try again.
      C:\Perl>ppm install dbd-mysql Version 2.1026 of 'DBD-mysql' is already installed. Remove it, or use 'verify --upgrade DBD-mysql'. C:\Perl>ppm verify --upgrade DBD-mysql Package 'DBD-mysql' is up to date.


      This is the extremely simple PERL program I used to test CGI and DBI taken from the so far good book "MySQL and PERL for the Web."
      #! /usr/bin/perl # intro2.pl - verify availability of CGI.pm and DBI modules use CGI; use DBI; $cgi = new CGI; print "The CGI object was created sauccesfully.\n"; @driver_names = DBI->available_drivers(); print "These DBI drivers are available: @driver_names\n"; exit(0);


      This runs just fine and dumps the output of all the drivers I am running.
      C:\Apache2\perl_dev>perl intro2.pl The CGI object was created sauccesfully. These DBI drivers are available: CSV ExampleP File ODBC Oracle Proxy S +QLite mysql


      Hopefully this will help to clarify a little bit more.
      Again, thank you for all the kind help.

        Maybe the module is up-to-date, but most likely it's for a different version of Perl. Run

        ppm remove DBD-mysql ppm install DBD-mysql

        BTW, how did you install it in the first place?

        Jenda
        Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
           -- Rick Osborne

        Edit by castaway: Closed small tag in signature

Re: DBI, Windows and Perl56.dll error
by BrowserUk (Patriarch) on May 15, 2003 at 18:38 UTC

    "Perhaps a required shared library or DLL is not installed where expected at Line 6."

    Isn't the name of the script where the above error occurs listed? It usually is.

    The reason I ask is because your sample code only has 5 lines, and I see nothing there that would cause the error you list. Obviously the error is coming from DBI.pm or one of the modules it loads. It would be very helpful to know which.

    The fact that something is even looking for a file called perl56.dll on a system that only has 5.8 is smells funny. My gut feeling, given your explicit demonstration of the install procedure you used, is that the ActiveState repository have either mixed up a 5.6 PPM with their 5.8 PPMs or the 5.8 package was linked against the wrong set of libraries. It might be worth raising the problem with AS and see if they are aware of anything.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
      First again thank you. To Jenda,
      I installed the module in first place via PPM process. So this should be exactly as you say. I will try the remove and install.

      This is the full error message as was given to me:
      C:\Apache2\cgi-bin>perl intro6.pl install_driver(mysql) failed: Can't load 'C:/Perl/site/lib/auto/DBD/my +sql/mysql. dll' for module DBD::mysql: load_file:The specified module could not b +e found at C:/Perl/lib/DynaLoader.pm line 229. at (eval 1) line 3 Compilation failed in require at (eval 1) line 3. Perhaps a required shared library or dll isn't installed where expecte +d at intro6.pl line 6

      Does this make sense to anyone? I am thinking there is a mixup in PERL versions somewhere as in I am running 5.8.0 but Activestate PPM beleives me to be using 5.6 or the PPM process believes this. Otherwise, it is possible to have problem with PPM process and I need to make Activestate aware. I am going to try manual install again and see if this clears up.
      Again, I am most gracious for all the help proffered. I have many things to try and resolve along lines I was not thinking.
      Akira

        Have you checked for the existance of

        C:/Perl/site/lib/auto/DBD/mysql/mysql.dll?

        From the "perl56.dll is missing" msg you mentioned earlier, and the error you are getting from perl, it's almost certain that you have a copy of mysql.dll on your system in the right place, but that it is attempting to import apis from perl56.dll. I've just checked the copy in the zip at AS 5.8 list and it is definately importing from perl58.dll, so it would appear there is a problem in the PPM process.

        If you still get the same problem after you have deleted and reinstalled using PPM. Then my recommendation would be to delete the DBD::MySql package using PPM. Then manually download the zip (via the link above), extract the .ppm and .tar.gz files onto your local harddrive and point PPM at them and redo the install from there.

        If that still doesn't work then you may also have to do the same for the rest of the DBI dependancy tree.

        Finally, if your really desperate, you could manually install the stuff. It isn't so very hard, but it isn't something to do unless your comfortable with it, as its quite difficult to describe, and you'll likely not get much help if you do it wrong.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
Re: DBI, Windows and Perl56.dll error
by PodMaster (Abbot) on May 16, 2003 at 04:47 UTC
    There is no doubt about it, you downloaded the wrong ppm binary. Look for ppm.xml in `perl -V:archlib'. Open it. Read it. Look for "mysql". On my perl5.6 it looks something like
    <PACKAGE NAME="DBD-Mysql"> <LOCATION>http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/ +PPMServer</LOCATION> <INSTPACKLIST>C:\Perl\site\lib\auto\DBD\Mysql\.packlist</INSTPACKL +IST> <INSTROOT>C:\Perl</INSTROOT> <INSTDATE>Fri Sep 6 03:20:14 2002</INSTDATE> <INSTPPD> <SOFTPKG NAME="DBD-Mysql" VERSION="1,2200,0,0"> <IMPLEMENTATION> <CODEBASE HREF="http://ppm.ActiveState.com/PPMPackages/5.6plus/MSW +in32-x86-multi-thread/DBD-Mysql.tar.gz" /> <DEPENDENCY NAME="DBI" VERSION="1,08,0,0" /> <ARCHITECTURE NAME="MSWin32-x86-multi-thread" /> <OS NAME="MSWin32" /> </IMPLEMENTATION> <ABSTRACT>DBI driver for Mysql datasources</ABSTRACT> <TITLE>DBD-Mysql</TITLE> <AUTHOR>Jochen Wiedmann (joe@ispsoft.de)</AUTHOR> </SOFTPKG> </INSTPPD> </PACKAGE>
    on my 5.8 activeperl it looks like
    <PACKAGE NAME="DBD-mysql"> <LOCATION>http://crazyinsomniac.perlmonk.org/perl/ppm/5.8</LOCATIO +N> <INSTPACKLIST>G:\Perl\site\lib\auto\DBD\mysql\.packlist</INSTPACKL +IST> <INSTROOT>G:\Perl</INSTROOT> <INSTDATE>Mon Mar 3 05:58:52 2003</INSTDATE> <INSTPPD> <SOFTPKG NAME="DBD-mysql" VERSION="2,1022,0,0"> <TITLE>DBD-mysql</TITLE> <ABSTRACT>A MySQL driver for the Perl5 Database Interface (DBI)</A +BSTRACT> <AUTHOR>Jochen Wiedmann &lt;joe@ispsoft.de&gt;</AUTHOR> <IMPLEMENTATION> <DEPENDENCY NAME="DBI" VERSION="1,08,0,0" /> <DEPENDENCY NAME="Data-Dumper" VERSION="0,0,0,0" /> <OS NAME="MSWin32" /> <ARCHITECTURE NAME="MSWin32-x86-multi-thread-5.8" /> <CODEBASE HREF="DBD-mysql-2.1022.tar.gz" /> </IMPLEMENTATION> </SOFTPKG>
    Here's another useful tidbit (you should really learn more about ppm)
    ppm> s mysql Searching in Active Repositories could not find ParserDetails.ini in G:/Perl/site/lib/XML/SAX 1. DBD-mysql [2.1026] A MySQL driver for the Perl5 Database Interfac +e (DBI) ppm> desc 1 ==================== Package 1: Name: DBD-mysql Version: 2.1026 Author: Jochen Wiedmann <joe@ispsoft.de> Title: DBD-mysql Abstract: A MySQL driver for the Perl5 Database Interface (DBI) Location: crazy Prerequisites: 1. DBI 1.08 2. Data-Dumper 0.0 Available Platforms: 1. MSWin32-x86-multi-thread ==================== ppm> desc --dump 1 ==================== Package 1: <SOFTPKG NAME="DBD-mysql" VERSION="2,1026,0,0"> <TITLE>DBD-mysql</TITLE> <ABSTRACT>A MySQL driver for the Perl5 Database Interface (DBI +)</ABSTRACT> <AUTHOR>Jochen Wiedmann &lt;joe@ispsoft.de&gt;</AUTHOR> <IMPLEMENTATION> <DEPENDENCY NAME="DBI" VERSION="1,08,0,0" /> <DEPENDENCY NAME="Data-Dumper" VERSION="0,0,0,0" /> <OS NAME="MSWin32" /> <ARCHITECTURE NAME="MSWin32-x86-multi-thread" /> <CODEBASE HREF="DBD-mysql-2.1026.tar.gz" /> </IMPLEMENTATION> </SOFTPKG> ==================== ppm> q
    So uninstall DBD-mysql, and then reinstall it, but make sure you're installing the appropriate one (I seriously doubt ActiveState would put up the wrong ppm -- maybe it was my repository that messed you up? I doubt that as well).


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      Saw this same problem on my PC and it was just a matter of correcting the paths on my PERL5LIB environment variable.
        No it isn't