_____
From: Eric Robertson [mailto:eric...@blueyonder.co.uk] Sent: September 27, 2010 2:33 PM To: 'Tim Bolshaw' Cc: activeperl@listserv.ActiveState.com Subject: RE: Problem Connecting to MySQL Database On Mon, Sep 27, 2010 at 3:06 AM, Eric Robertson <eric...@blueyonder.co.uk> wrote: I'm using a MacBook Pro running OS X 10.6.4 and I installed ActiveState Perl - I'm using version 5.8.8 at the moment. I did this to make it easier to install some of the modules I wanted but I'm not sure I wouldn't have been better just to use the Perl that comes with the Mac OS! The problem I have is that I can't connect to a MySQL database that I have on the MacBook, set up using MAMP PRO. When I was running everything under Windows I used to have the DBD::mysql driver installed but this doesn't seem to be available for this build so I'm using DBD::mysqlPP which I assume should work in the same way. However the connection string fails when I try to connect using the following: $dsn = "DBI:mysqlPP:host=localhost:database=$database"; $dbh = DBI->connect($dsn, $username, $database, { RaiseError => 0, PrintError => 0}) || ($error = "Got error '$DBI::errstr' when connecting to $dsn\n"); and the error message is: Got error 'Couldn't connect to localhost:3306/tcp: IO::Socket::INET: connect: Connection refused at /Users/(myname)/Library/ActivePerl/lib/DBD/mysqlPP.pm line 109' when connecting to DBI:mysqlPP:host=localhost:database=$database. I've checked that I was using the correct username and password, setting up and trying different ones, but without success. I have a feeling that I read somewhere that there was a problem using Perl to connect to a database set up under MAMP but can't recall what the problem was. Can anyone suggest why this is not working. Eric Robertson _____ From: Tim Bolshaw [mailto:timothybols...@gmail.com] Sent: 27 September 2010 16:02 To: Eric Robertson Subject: Re: Problem Connecting to MySQL Database $dsn="DBI:mysqlPP:host=localhost;database=$database"; (i.e, replace colon with semicolon after localhost) -- Tim Bolshaw timothybols...@gmail.com Mobile: +66-(0)87 072 5009 Tim I'm afraid this didn't work - I got the same error message. In fact I had tested the connection string with the colon on the live server and this worked OK but I need to use my own server for testing so that I can debug my code in Komodo. Eric. _____ From: Czarnowas, Andrew [mailto:andrew.czarno...@thebeerstore.ca] Sent: 27 September 2010 20:56 To: Eric Robertson Subject: RE: Problem Connecting to MySQL Database $dsn = "DBI:mysqlPP:host=localhost:database=$database"; $dbh = DBI->connect($dsn, $username, $database, { RaiseError => 0, PrintError => 0}) || ($error = "Got error '$DBI::errstr' when connecting to $dsn\n"); Should this be password? Andrew Yes, it should - I did use an actual password here but had meant to replace it with $password, so that isn't the problem unfortunately. Eric. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.856 / Virus Database: 271.1.1/3160 - Release Date: 09/26/10 08:01:00
_______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs