FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=17059&edit=1

ID: 17059
Updated by: l.alberton@quipo.it
Reported By: babbomaria at interfree dot it
Summary: Get connection error problem with mysql driver
-Status: Open
+Status: Bogus
Type: Documentation Problem
Package: MDB2
Operating System: Win 2k
Package Version: 2.5.0b2
PHP Version: 5.3.0
-Assigned To:
+Assigned To: quipo
Roadmap Versions:
New Comment:

-Status: Open
+Status: Bogus
-Assigned To:
+Assigned To: quipo
You're checking the wrong object


if (PEAR::isError($res)) {
die($res->getMessage()." :: ".$res->getDebugInfo());


Previous Comments:
------------------------------------------------------------------------

[2010-02-03 09:44:13] babbomari

Description:
------------
//conection info
$DATABASE_SERVER='localhost';
$DATABASE_USERNAME='user';
$DATABASE_PASSWORD='pass';
$DATABASE_NAME='dbONE';
//connect to the database.
//we could have used an abstracting layer for connecting to the
database.
//for the sake of simplicity, I choose not to.

$dns="mysqli://$DATABASE_USERNAME:$DATABASE_PASSWORD@$DATABASE_SERVER/$DATABASE_NAME";

$mdb2=& MDB2::singleton($dns);
if (PEAR::isError($mdb2)) {
//die($mdb2->getMessage().$mdb2->getDebugInfo());

$this->myLogFile->log(/*$mdb2->getMessage().$mdb2->getDebugInfo().*/'Connection
error',PEAR_LOG_ERR);
$returnValue=false;
}

Test script:
---------------
i turn off mysql 4.1 an apache ON

Expected result:
----------------
$mdb2->getMessage().$mdb2->getDebugInfo() give the string containing
the connection problem

Actual result:
--------------
the connection doesn't return any information, but th next sql query
return a an error that i catch with
$res = $mdb2->query($sql);
if (PEAR::isError($res)) {
die($mdb2->getMessage().$mdb2->getDebugInfo());
}
I get this error

Call to undefined function: MDB2_Driver_mysqli::getMessage(). in
C:\wamp\bin\php\php5.3.0\PEAR\MDB2.php on line 1993

# Time Memory Function Location
1 0.1157 414304 {main}( ) ..\IdentificationService.php:0
2 15.6378 1639696 IdentificationService->GetAll(
) ..\IdentificationService.php:140
3 1286.3295 2395552 MDB2_Driver_mysqli->getMessage(
) ..\IdentificationService.php:117
4 1286.3296 2395704 MDB2_Driver_Common->__call( ???, ???
) ..\MDB2.php:0
5 1286.3298 2396680 trigger_error ( ???, ??? )

------------------------------------------------------------------------

Search Discussions

  • Babbomaria at Feb 3, 2010 at 1:20 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=17059&edit=1

    ID: 17059
    Updated by: babbomaria@interfree.it
    Reported By: babbomaria at interfree dot it
    Summary: Get connection error problem with mysql driver
    Status: Bogus
    Type: Documentation Problem
    Package: MDB2
    Operating System: Win 2k
    Package Version: 2.5.0b2
    PHP Version: 5.3.0
    Assigned To: quipo
    Roadmap Versions:
    New Comment:

    OK I've solved the second part of the problem now i can get the correct
    error on the right resource element.

    Anyway why my connection doesn't report error when i try $mdb2=&
    MDB2::singleton($dns); when the DB is off. The error is rised only on
    query execution. Can i force a connection test before running a query.
    THE if (PEAR::isError($mdb2)) {.... what kind of error can intercept??


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-02-03 10:42:44] quipo

    -Status: Open
    +Status: Bogus
    -Assigned To:
    +Assigned To: quipo
    You're checking the wrong object


    if (PEAR::isError($res)) {
    die($res->getMessage()." :: ".$res->getDebugInfo());

    ------------------------------------------------------------------------

    [2010-02-03 09:44:13] babbomari

    Description:
    ------------
    //conection info
    $DATABASE_SERVER='localhost';
    $DATABASE_USERNAME='user';
    $DATABASE_PASSWORD='pass';
    $DATABASE_NAME='dbONE';
    //connect to the database.
    //we could have used an abstracting layer for connecting to the
    database.
    //for the sake of simplicity, I choose not to.

    $dns="mysqli://$DATABASE_USERNAME:$DATABASE_PASSWORD@$DATABASE_SERVER/$DATABASE_NAME";

    $mdb2=& MDB2::singleton($dns);
    if (PEAR::isError($mdb2)) {
    //die($mdb2->getMessage().$mdb2->getDebugInfo());

    $this->myLogFile->log(/*$mdb2->getMessage().$mdb2->getDebugInfo().*/'Connection
    error',PEAR_LOG_ERR);
    $returnValue=false;
    }

    Test script:
    ---------------
    i turn off mysql 4.1 an apache ON

    Expected result:
    ----------------
    $mdb2->getMessage().$mdb2->getDebugInfo() give the string containing
    the connection problem

    Actual result:
    --------------
    the connection doesn't return any information, but th next sql query
    return a an error that i catch with
    $res = $mdb2->query($sql);
    if (PEAR::isError($res)) {
    die($mdb2->getMessage().$mdb2->getDebugInfo());
    }
    I get this error

    Call to undefined function: MDB2_Driver_mysqli::getMessage(). in
    C:\wamp\bin\php\php5.3.0\PEAR\MDB2.php on line 1993

    # Time Memory Function Location
    1 0.1157 414304 {main}( ) ..\IdentificationService.php:0
    2 15.6378 1639696 IdentificationService->GetAll(
    ) ..\IdentificationService.php:140
    3 1286.3295 2395552 MDB2_Driver_mysqli->getMessage(
    ) ..\IdentificationService.php:117
    4 1286.3296 2395704 MDB2_Driver_Common->__call( ???, ???
    ) ..\MDB2.php:0
    5 1286.3298 2396680 trigger_error ( ???, ??? )

    ------------------------------------------------------------------------
  • L Alberton at Feb 3, 2010 at 1:51 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=17059&edit=1

    ID: 17059
    Updated by: l.alberton@quipo.it
    Reported By: babbomaria at interfree dot it
    Summary: Get connection error problem with mysql driver
    Status: Bogus
    Type: Documentation Problem
    Package: MDB2
    Operating System: Win 2k
    Package Version: 2.5.0b2
    PHP Version: 5.3.0
    Assigned To: quipo
    Roadmap Versions:
    New Comment:

    http://pear.php.net/manual/en/package.database.mdb2.intro-connect.php

    Please read the difference between factory(), connect() and
    singleton().

    connect() will establish a db connection immediately, the other two
    only connect when needed (i.e. when running a query: lazy load).

    all errors returned by MDB2 are extended from PEAR_Error, so you can
    catch them all with PEAR::isError($res);


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-02-03 13:17:53] babbomari

    OK I've solved the second part of the problem now i can get the correct
    error on the right resource element.

    Anyway why my connection doesn't report error when i try $mdb2=&
    MDB2::singleton($dns); when the DB is off. The error is rised only on
    query execution. Can i force a connection test before running a query.
    THE if (PEAR::isError($mdb2)) {.... what kind of error can intercept??

    ------------------------------------------------------------------------

    [2010-02-03 10:42:44] quipo

    -Status: Open
    +Status: Bogus
    -Assigned To:
    +Assigned To: quipo
    You're checking the wrong object


    if (PEAR::isError($res)) {
    die($res->getMessage()." :: ".$res->getDebugInfo());

    ------------------------------------------------------------------------

    [2010-02-03 09:44:13] babbomari

    Description:
    ------------
    //conection info
    $DATABASE_SERVER='localhost';
    $DATABASE_USERNAME='user';
    $DATABASE_PASSWORD='pass';
    $DATABASE_NAME='dbONE';
    //connect to the database.
    //we could have used an abstracting layer for connecting to the
    database.
    //for the sake of simplicity, I choose not to.

    $dns="mysqli://$DATABASE_USERNAME:$DATABASE_PASSWORD@$DATABASE_SERVER/$DATABASE_NAME";

    $mdb2=& MDB2::singleton($dns);
    if (PEAR::isError($mdb2)) {
    //die($mdb2->getMessage().$mdb2->getDebugInfo());

    $this->myLogFile->log(/*$mdb2->getMessage().$mdb2->getDebugInfo().*/'Connection
    error',PEAR_LOG_ERR);
    $returnValue=false;
    }

    Test script:
    ---------------
    i turn off mysql 4.1 an apache ON

    Expected result:
    ----------------
    $mdb2->getMessage().$mdb2->getDebugInfo() give the string containing
    the connection problem

    Actual result:
    --------------
    the connection doesn't return any information, but th next sql query
    return a an error that i catch with
    $res = $mdb2->query($sql);
    if (PEAR::isError($res)) {
    die($mdb2->getMessage().$mdb2->getDebugInfo());
    }
    I get this error

    Call to undefined function: MDB2_Driver_mysqli::getMessage(). in
    C:\wamp\bin\php\php5.3.0\PEAR\MDB2.php on line 1993

    # Time Memory Function Location
    1 0.1157 414304 {main}( ) ..\IdentificationService.php:0
    2 15.6378 1639696 IdentificationService->GetAll(
    ) ..\IdentificationService.php:140
    3 1286.3295 2395552 MDB2_Driver_mysqli->getMessage(
    ) ..\IdentificationService.php:117
    4 1286.3296 2395704 MDB2_Driver_Common->__call( ???, ???
    ) ..\MDB2.php:0
    5 1286.3298 2396680 trigger_error ( ???, ??? )

    ------------------------------------------------------------------------
  • Babbomaria at Feb 3, 2010 at 2:22 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=17059&edit=1

    ID: 17059
    Updated by: babbomaria@interfree.it
    Reported By: babbomaria at interfree dot it
    Summary: Get connection error problem with mysql driver
    -Status: Bogus
    +Status: Closed
    Type: Documentation Problem
    Package: MDB2
    Operating System: Win 2k
    Package Version: 2.5.0b2
    PHP Version: 5.3.0
    Assigned To: quipo
    Roadmap Versions:
    New Comment:

    -Status: Bogus
    +Status: Closed
    ok i understand i have slices of salami on the eyes "FETTE DI SALAME
    SUGLI OCCHI"


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-02-03 13:49:17] quipo

    http://pear.php.net/manual/en/package.database.mdb2.intro-connect.php

    Please read the difference between factory(), connect() and
    singleton().

    connect() will establish a db connection immediately, the other two
    only connect when needed (i.e. when running a query: lazy load).

    all errors returned by MDB2 are extended from PEAR_Error, so you can
    catch them all with PEAR::isError($res);

    ------------------------------------------------------------------------

    [2010-02-03 13:17:53] babbomari

    OK I've solved the second part of the problem now i can get the correct
    error on the right resource element.

    Anyway why my connection doesn't report error when i try $mdb2=&
    MDB2::singleton($dns); when the DB is off. The error is rised only on
    query execution. Can i force a connection test before running a query.
    THE if (PEAR::isError($mdb2)) {.... what kind of error can intercept??

    ------------------------------------------------------------------------

    [2010-02-03 10:42:44] quipo

    -Status: Open
    +Status: Bogus
    -Assigned To:
    +Assigned To: quipo
    You're checking the wrong object


    if (PEAR::isError($res)) {
    die($res->getMessage()." :: ".$res->getDebugInfo());

    ------------------------------------------------------------------------

    [2010-02-03 09:44:13] babbomari

    Description:
    ------------
    //conection info
    $DATABASE_SERVER='localhost';
    $DATABASE_USERNAME='user';
    $DATABASE_PASSWORD='pass';
    $DATABASE_NAME='dbONE';
    //connect to the database.
    //we could have used an abstracting layer for connecting to the
    database.
    //for the sake of simplicity, I choose not to.

    $dns="mysqli://$DATABASE_USERNAME:$DATABASE_PASSWORD@$DATABASE_SERVER/$DATABASE_NAME";

    $mdb2=& MDB2::singleton($dns);
    if (PEAR::isError($mdb2)) {
    //die($mdb2->getMessage().$mdb2->getDebugInfo());

    $this->myLogFile->log(/*$mdb2->getMessage().$mdb2->getDebugInfo().*/'Connection
    error',PEAR_LOG_ERR);
    $returnValue=false;
    }

    Test script:
    ---------------
    i turn off mysql 4.1 an apache ON

    Expected result:
    ----------------
    $mdb2->getMessage().$mdb2->getDebugInfo() give the string containing
    the connection problem

    Actual result:
    --------------
    the connection doesn't return any information, but th next sql query
    return a an error that i catch with
    $res = $mdb2->query($sql);
    if (PEAR::isError($res)) {
    die($mdb2->getMessage().$mdb2->getDebugInfo());
    }
    I get this error

    Call to undefined function: MDB2_Driver_mysqli::getMessage(). in
    C:\wamp\bin\php\php5.3.0\PEAR\MDB2.php on line 1993

    # Time Memory Function Location
    1 0.1157 414304 {main}( ) ..\IdentificationService.php:0
    2 15.6378 1639696 IdentificationService->GetAll(
    ) ..\IdentificationService.php:140
    3 1286.3295 2395552 MDB2_Driver_mysqli->getMessage(
    ) ..\IdentificationService.php:117
    4 1286.3296 2395704 MDB2_Driver_Common->__call( ???, ???
    ) ..\MDB2.php:0
    5 1286.3298 2396680 trigger_error ( ???, ??? )

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedFeb 3, '10 at 10:45a
activeFeb 3, '10 at 2:22p
posts4
users2
websitepear.php.net

2 users in discussion

Babbomaria: 2 posts L Alberton: 2 posts

People

Translate

site design / logo © 2022 Grokbase