473,789 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PEAR MDB2 Unknown Error

Hey all -

I'm bumping into an issue with my installation of the MDB2 package
that I'm hoping someone else has seen. I'm trying to execute a query,
but get an "unknown error" exception that I can't seem to track down
(exact message is "MDB2 Error: unknown error").

I have an ObjectDAO class (which I'm creating via a factory) that
extends an abstract DataAccessObjec t class. The database connection
is created in the parent class' constructor and a connection *is*
being established. I just can't seem to query against it. Here's the
code I'm trying to execute:

=============== =============== =============== ==========

$dao = DAOFactory::cre ateDAO ( 'Object' );
$result = $dao->conn->query ( 'SELECT COUNT(1) FROM object' );
if ( PEAR::isError ( $result ) ) {
echo '<p>SQL Error</p>';
throw new Exception ( $result->getMessage() );
}
new PHPDump ( $result->fetchRow() );

exit();

=============== =============== =============== ==========

A dump of the $dao variable indicates that all properties and members
are public, as expected. Executing "./pear version" reveals:

PEAR Version: 1.6.2
PHP Version: 5.2.3
Zend Engine Version: 2.2.0

I've been fighting this all day and can't think of anything else to
try, nor can I find any additional information via Google. If
anyone's seen this, I'd really appreciate any insight.

Thanks.

Rob
Nov 23 '07 #1
3 6443
On Nov 23, 2:04 pm, Rob Wilkerson <r.d.wilker...@ gmail.comwrote:
Hey all -

I'm bumping into an issue with my installation of the MDB2 package
that I'm hoping someone else has seen. I'm trying to execute a query,
but get an "unknown error" exception that I can't seem to track down
(exact message is "MDB2 Error: unknown error").

I have an ObjectDAO class (which I'm creating via a factory) that
extends an abstract DataAccessObjec t class. The database connection
is created in the parent class' constructor and a connection *is*
being established. I just can't seem to query against it. Here's the
code I'm trying to execute:

=============== =============== =============== ==========

$dao = DAOFactory::cre ateDAO ( 'Object' );
$result = $dao->conn->query ( 'SELECT COUNT(1) FROM object' );
if ( PEAR::isError ( $result ) ) {
echo '<p>SQL Error</p>';
throw new Exception ( $result->getMessage() );}

new PHPDump ( $result->fetchRow() );

exit();

=============== =============== =============== ==========

A dump of the $dao variable indicates that all properties and members
are public, as expected. Executing "./pear version" reveals:

PEAR Version: 1.6.2
PHP Version: 5.2.3
Zend Engine Version: 2.2.0

I've been fighting this all day and can't think of anything else to
try, nor can I find any additional information via Google. If
anyone's seen this, I'd really appreciate any insight.
Looks like I've got some kind of problem connecting to MAMP's MySQL db
on OS X. I haven't tracked down what it might be, but attempting to
use the standard mysqli_connect( ) and mysql_connect() functions yield
a more verbose error that at least gives me somewhere else to look...
Nov 23 '07 #2
Hi,

You can get more info using $err->getUserInfo( ).

PAER error handling can also be triggered without checking isError:

PHP 5:

function Php5PearErrorHa ndler($err)
{
$ui = $err->getUserInfo( );
$str = $err->getMessage() ;
if ($ui != '') {
$str .= ' (' . $ui . ')';
}
throw new PEAR_Exception( $str, $err->getCode());
}

PEAR::setErrorH andling(PEAR_ER ROR_CALLBACK, 'Php5PearErrorH andler');

PHP 4:

function Php4PearErrorHa ndler($err)
{
$ui = $err->getUserInfo( );
$str = $err->getMessage() ;
if ($ui != '') {
$str .= ' (' . $ui . ')';
}
trigger_error($ str, E_USER_ERROR);
}

PEAR::setErrorH andling(PEAR_ER ROR_CALLBACK, 'Php4PearErrorH andler');

On Nov 23, 2:04 pm, Rob Wilkerson <r.d.wilker...@ gmail.comwrote:
Hey all -

I'm bumping into an issue with my installation of the MDB2 package
that I'm hoping someone else has seen. I'm trying to execute a query,
but get an "unknown error" exception that I can't seem to track down
(exact message is "MDB2 Error: unknown error").

I have an ObjectDAO class (which I'm creating via a factory) that
extends an abstract DataAccessObjec t class. The database connection
is created in the parent class' constructor and a connection *is*
being established. I just can't seem to query against it. Here's the
code I'm trying to execute:

=============== =============== =============== ==========

$dao = DAOFactory::cre ateDAO ( 'Object' );
$result = $dao->conn->query ( 'SELECT COUNT(1) FROM object' );
if ( PEAR::isError ( $result ) ) {
echo '<p>SQL Error</p>';
throw new Exception ( $result->getMessage() );}

new PHPDump ( $result->fetchRow() );

exit();

=============== =============== =============== ==========

A dump of the $dao variable indicates that all properties and members
are public, as expected. Executing "./pear version" reveals:

PEAR Version: 1.6.2
PHP Version: 5.2.3
Zend Engine Version: 2.2.0

I've been fighting this all day and can't think of anything else to
try, nor can I find any additional information via Google. If
anyone's seen this, I'd really appreciate any insight.

Thanks.

Rob
Nov 24 '07 #3
On Nov 24, 5:19 am, petersprc <peters...@gmai l.comwrote:
Hi,

You can get more info using $err->getUserInfo( ).

PAER error handling can also be triggered without checking isError:

PHP 5:

function Php5PearErrorHa ndler($err)
{
$ui = $err->getUserInfo( );
$str = $err->getMessage() ;
if ($ui != '') {
$str .= ' (' . $ui . ')';
}
throw new PEAR_Exception( $str, $err->getCode());
}

PEAR::setErrorH andling(PEAR_ER ROR_CALLBACK, 'Php5PearErrorH andler');
For what it's worth, it looks like my problem was in the way my MySQL
user was created. I didn't realize that "%" meant any host OTHER THAN
localhost. I thought it just meant "any host" (including localhost).
Thats for the error handling information, though. That may come in
handy.
Nov 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
620
by: Michael G | last post by:
Hi, Is PEAR DB worth using? Slower? Other problems? Or should a person just wrap db functions in a user-defined class? Mike
1
7842
by: CSTechie | last post by:
I've been battling to install PEAR on Windows XP now for too long. I am not sure what I need to do. When I run go-pear.php from the command line, I get the error message as shown at the end. I included everything in case there is something there that's helpful. I'm trying to install PEAR so that I can use PHPUnit. Thanks for the help!!!!
0
1333
by: scottauge | last post by:
I cannot for the life of me get a connection using MDB2 to a PostgreSQL 8.1 database. I can get a connection just fine using: $db = pg_connect ("host=localhost port=5432 dbname=subscriber user=scottauge password=mypassword"); and using a dsn:
3
9298
by: Anthony Smith | last post by:
I always get this message. No matter what package $ pear install Date PHP Warning: Module 'oci8' already loaded in Unknown on line 0 No releases available for package "pear.php.net/Date" Cannot initialize 'Date', invalid or missing package file Package "Date" is not valid install failed
2
6313
by: salvadorvp | last post by:
Hi, I have the following code that gives me this odd error message at a line of code inside the PEAR libraries: "Fatal error: Call to undefined function: MDB2_Driver_mssql::getMessage(). in C:\php\PEAR\lib\MDB2.php on line 1921" My code is a simple submit processing form for a login page: <?php
5
5220
by: john | last post by:
All: Very experienced developer, newbie to PHP. My situation: I have installed on my WIndows XP machine the following: * PHP 5.2.1 * MySQL 5.0 * Apache 2.2 All of these are installed under C:\Program Files under their own
5
3568
by: jmark | last post by:
I need some assistance on how to create a select statement using PEAR DB or MySQL with the LIKE function. That is I am looking of how I can get statement like this work. SELECT * FROM customer WHERE name LIKE '%?'
2
1805
by: Sal | last post by:
I have error_reporting set at E_ALL | E_STRICT and get 35 Strict Standards notices every time I load MDB2. Is this something to be concerned about, and is this typical of other PEAR packages?
0
1522
by: exclaim | last post by:
Apologies if this is not the right forum. I have an application written originally to work with MySQL which now has to be extended to work with MSSQL also. I have modified all my database calls to use the PEAR MDB2 methods rather than mysqli. Everything still works fine with MySQL, but I have an odd problem when I test against MSSQL. Any database query which does not return a resultset is OK e.g. an update works fine. If I execute a...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9499
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5404
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5539
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4076
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2898
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.