2009年1月28日星期三

[fw-db] Zend_Db_Adapter_DB2 on I5

Hi,

 

I’m trying to use Zend_Db on my I5 but I have some problems.

I create a little test file and test it on 2 I5 (one V5R3 and one V5R4).

I downloaded the latest svn trunk for testing.

 

[code]

<?php

require_once "Zend/Loader.php";

// Set up autoload.

Zend_Loader::registerAutoload();

 

class Alertes extends Zend_Db_Table_Abstract {

        /**

         * The default table name

         */

        protected $_name = 'MYFILE';

        protected $_schema = 'MYLIB';

        protected $_primary = 'MACLE';

}

 

$db = Zend_Db::factory('Db2',array(

        'host'=>'127.0.0.1',

        'username'=>'USERNAME',

        'password'=>'password',

        'dbname'=>'DATABASE'));

Zend_Db_Table::setDefaultAdapter($db);

 

// #1

$sql = 'select * from MYLIB.MYFILE';

print_r($db->fetchAll($sql));

 

// #2

$alertes = new Alertes();

print_r($alertes->fetchAll());

?>

[/code]

 

On V5R3, nothing works. I got this message (as the message is in French, message is : Connection to database DATABASE already done) :

[code]

[28-Jan-2009 14:33:40] PHP Fatal error:  Uncaught exception 'Zend_Db_Adapter_Db2_Exception' with message 'Connexion à base de données relationnelle DATABASE déjà établie. SQLCODE=-842' in /usr/local/Zend/ZendFramework-1.7.3/library/Zend/Db/Adapter/Db2.php:191

Stack trace:

#0 /usr/local/Zend/ZendFramework-1.7.3/library/Zend/Db/Adapter/Abstract.php(441): Zend_Db_Adapter_Db2->_connect()

#1 /usr/local/Zend/ZendFramework-1.7.3/library/Zend/Db/Adapter/Abstract.php(668): Zend_Db_Adapter_Abstract->query('select * from M...', Array)

#2 /www/php/site/admin/public/testdb.php(16): Zend_Db_Adapter_Abstract->fetchAll('select * from M...')

#3 {main}

  thrown in /usr/local/Zend/ZendFramework-1.7.3/library/Zend/Db/Adapter/Db2.php on line 191

[/code]

 

On V5R4, the #1 works fine but not #2 wich this message :

[code]

[28-Jan-2009 11:43:53] PHP Fatal error:  Uncaught exception 'Zend_Db_Statement_Db2_Exception' with message 'Qualificatif de colonne ou table MYFILE non défini. SQLCODE=-5001' in /usr/local/Zend/ZendFramework-1.7/library/Zend/Db/Statement/Db2.php:71

Stack trace:

#0 /usr/local/Zend/ZendFramework-1.7/library/Zend/Db/Statement.php(109): Zend_Db_Statement_Db2->_prepare('select MYFILE...')

#1 /usr/local/Zend/ZendFramework-1.7/library/Zend/Db/Adapter/Db2.php(230): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Db2), 'select MYFILE...')

#2 /usr/local/Zend/ZendFramework-1.7/library/Zend/Db/Adapter/Abstract.php(456): Zend_Db_Adapter_Db2->prepare('select MYFILE...')

#3 /usr/local/Zend/ZendFramework-1.7/library/Zend/Db/Adapter/Abstract.php(668): Zend_Db_Adapter_Abstract->query('select MYFILE...', Array)

#4 /www/alertes/public/testdb.php(23): Zend_Db_Adapter_Abstract->fetchAll('select MYFILE...')

#5 {main}

  thrown in /usr/local/Zend/ZendFramework-1.7/library/Zend/Db/Statement/Db2.php on line 71

[/code]

The sql generated by Zend_DB_Table does not work on I5.

 

Did I miss something ?

 

Thanks,

David

没有评论: