Forums / General / Error eZMySQLDB

Error eZMySQLDB

Author Message

César Camelo

Monday 16 January 2006 6:58:47 am

Hi! I have to fetch data from other database called "corral_cmadbprod", when I get the data. I've got an error: Error: eZMySQLDB.

Here's the SQL debug output (when I see the fetched data)

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

Notice: eZMySQLDB::query(0.000 ms) query number per page:0 Jan 16 2006 09:26:23

SET NAMES 'latin1'

Error: eZMySQLDB Jan 16 2006 09:26:23

Query error: Table 'corral_cmadbprod.ezcontentobject_tree' doesn't exist. Query: SELECT ezcontentobject.*,
ezcontentobject_tree.*,
ezcontentclass.name as class_name,
ezcontentclass.identifier as class_identifier
, ezcontentobject_name.name as name, ezcontentobject_name.real_translation
FROM ezcontentobject_tree,
ezcontentobject,
ezcontentclass
, ezcontentobject_name
WHERE node_id IN ( 359 ) AND
ezcontentobject_tree.contentobject_id=ezcontentobject.id AND
ezcontentclass.version=0 AND
ezcontentclass.id = ezcontentobject.contentclass_id
and ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id and
ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version and
ezcontentobject_name.content_translation = 'esl-CO'

Notice: eZMySQLDB::query(0.000 ms) query number per page:1 Jan 16 2006 09:26:23

SELECT ezcontentobject.*,
ezcontentobject_tree.*,
ezcontentclass.name as class_name,
ezcontentclass.identifier as class_identifier
, ezcontentobject_name.name as name, ezcontentobject_name.real_translation
FROM ezcontentobject_tree,
ezcontentobject,
ezcontentclass
, ezcontentobject_name
WHERE node_id IN ( 359 ) AND
ezcontentobject_tree.contentobject_id=ezcontentobject.id AND
ezcontentclass.version=0 AND
ezcontentclass.id = ezcontentobject.contentclass_id
and ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id and
ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version and
ezcontentobject_name.content_translation = 'esl-CO'
------------------------------------------------------------------------

It seems like eZ is trying to do something with the other database. I really don't know!!
Any Ideas?

Łukasz Serwatka

Friday 20 January 2006 2:26:49 am

Hi Cesar,

You will need to force new instance when you want to connect to external database from your module/script

Example code can look:

$dsn = array(
'server'        => 'localhost' ),
'user'          => 'db_usr' ),
'password'      => 'passwd' ),
'database'      => 'external_db' ),
);

$extdb =& eZDB::instance( 'ezmysql', $dsn, true  );
$extdb->arrayQuery( ... )

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

César Camelo

Monday 23 January 2006 1:39:04 pm

Thank so much, that solved my problem!