var $default = array(
'driver' => 'adodb',
'connect' => 'informix',
'persistent' => false,
'host' => 'myserver',
'port' => '9109',
'login' => 'informix',
'password' => 'mypass',
'database' => 'mydb',
'schema' => '',
'prefix' => '',
'encoding' => ''
);
Somehow, this configuration setting works and cakephp's default homepage now shows that it can connect to a database. However, when I try to create a model, and scaffold a controller, it tells me that the table for the model cannot be found.
So then I scour the cyberspace again, looking for the possibility of the existence of a pdo_informix.php file, and I found it hidden in the cakephp google groups, written by Marcelo of San Luis, Argentina. The link can be found here. You need to change the code a little, to set the INFORMIXSERVER environment and get rid of the error
SQLSTATE=IX 000 SQLCODE=-25596
...
function connect()
{
$config = $this->config;
$connect = $config['connect'];
$this->connected = false;
$host = $config['database'] . '@' . $config['host'];
$argHostname = $config['host'];
if ($argHostname) putenv("INFORMIXSERVER=$argHostname");
putenv("INFORMIXSERVER=".trim($argHostname));
if ($config['persistent'])
{
$this->connection = ifx_pconnect($host, $config['login'], $config['password']);
}
else
{
$this->connection = $connect($host, $config['login'], $config['password']);
}
$this->connected = ($this->connection !== false);
return $this->connected;
}
...
Hopefully, the rest of the code can be recycled. I have not tested them yet.
No comments:
Post a Comment