PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Mail Queue Error: Cannot connect to database

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail
View previous topic :: View next topic  
Author Message
djalig



Joined: 18 Jun 2008
Posts: 2

PostPosted: Wed Jun 18, 2008 8:13 pm    Post subject: Mail Queue Error: Cannot connect to database Reply with quote

Hi, I am having trouble with Mail_queue

Here are my options:

$container_options = array(
'type' => 'db',
// 'dsn' => 'mysql://username:password@dbname',
'database' => 'localhost/dbname',
'phptype' => 'mysql',
'username' => 'username',
'password' => 'password',
'mail_table' => 'mail_queue'
);

$mail_options = array(
'driver' => 'smtp',
'host' => 'mail.xxxxxxxx.com',
'port' => 587,
'auth' => true,
'username' => 'xxxxxxxx',
'password' => 'xxxxxxxx');


When calling $mail_queue->put( $emailfrom, $to, $headers, $body );
I get the following message:

Mail Queue Error: Cannot connect to database

I am using MAMP on the Mac to run my db. Server is localhost port 8889 for mysql. I have tried both the dsn and db options, with localhost/dbname, localhost:8889/dbname and just dbname but none of the combinations work. The username and password are 100% correct!

Any help would be VERY grateful!

Thanks
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1003

PostPosted: Wed Jun 18, 2008 10:40 pm    Post subject: Reply with quote

Mail_Queue doesn't seem to report back the full error message of the DB package.

To test your connection to the database, you can use the following lines of code:
Code:

require_once 'DB.php';
$dsn = ...; // either as an array or as a string ('dsn' key of your $container_options variable)
$db =& DB::connect($dsn);
if (DB::isError($db)) {
    die($db->getMessage() . ', ' . $db->getDebugInfo());
}


With these lines you should get a more helpful message about the connection problem.
Back to top
View user's profile Send private message
djalig



Joined: 18 Jun 2008
Posts: 2

PostPosted: Thu Jun 19, 2008 12:03 am    Post subject: Reply with quote

Thank you so much.

I needed to use localhost/dbname in the dns string

Everything is now working!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software