PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old August 14th, 2006, 11:36 PM
batalha batalha is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: São Paulo
Posts: 3 batalha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to batalha
Always have a "MDB2 Error: connect failed" trying to connect to MYSQL

Hi,

I´m always having "MDB2 Error: connect failed" error when I try to connect to MYSQL database using MDB2.

I´m just trying to do the basic sample from PEAR works.

This is the code.

<?php
require_once 'MDB2.php';

$dsn = array(
'phptype' => 'mysql',
'username' => 'lasar',
'password' => 'lasar',
'hostspec' => 'localhost',
'database' => 'secs',
);

$options = array(
'debug' => 2,
'portability' => MDB2_PORTABILITY_ALL,
);

// uses MDB2::factory() to create the instance
// and also attempts to connect to the host
$mdb2 =& MDB2::connect($dsn, $options);
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
?>

all the parameter for the connection are ok, I use this parameter to connect to the database using EMS to MYSQL.

I alreasy have tried to connecti using DSN but I have the same error.

Please, someone could help me to solve this problem.

Thanks.

Reply With Quote
  #2  
Old August 15th, 2006, 01:29 PM
batalha batalha is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: São Paulo
Posts: 3 batalha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to batalha
RE: Always have a "MDB2 Error: connect failed" trying to connect to MYSQL

Another point!

When I try to connect to a no local database server, the connection works, but when I try to connect to a localhost database it isn´t work.


Reply With Quote
  #3  
Old September 4th, 2006, 07:15 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 26
RE: Always have a "MDB2 Error: connect failed" trying to connect to MYSQL

I'm encountering the same problem. Does anyone have a solution to propose?

Reply With Quote
  #4  
Old September 24th, 2006, 09:54 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 26
RE: Always have a "MDB2 Error: connect failed" trying to connect to MYSQL

Localhost mysql server could be accessed in two ways: via TCP/IP or via socket.
Remote mysql server could be accessed only via TCP/IP.

If your remote connection works, but localhost not, there should be some parametr to fill in the $dsn array to specify that you would like to use the socket way of connection...

Reply With Quote
  #5  
Old November 21st, 2006, 02:36 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 26
RE: Always have a "MDB2 Error: connect failed" trying to connect to MYSQL

Try using 127.0.0.1 for the hostname - this solved the issue for me ... looks like a bad DNS resolution problem

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > Always have a "MDB2 Error: connect failed" trying to connect to MYSQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.


© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 10 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek