Tuesday, September 17, 2013

Database connection 'Postgres' is missing

Using version 2.3.8.

 

First time trying to bake using Postgresql and this is the error:

 

K:\wamp\www\community\app>cake bake

 

Welcome to CakePHP v2.3.8 Console

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

App : app

Path: K:\wamp\www\community\app\

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

Interactive Bake Shell

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

[D]atabase Configuration

[M]odel

[V]iew

[C]ontroller

[P]roject

[F]ixture

[T]est case

[Q]uit

What would you like to Bake? (D/M/V/C/P/F/T/Q)

> m

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

Bake Model

Path: K:\wamp\www\community\app\Model\

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

Error: Database connection "Postgres" is missing, or could not be created.

#0 K:\wamp\www\libs\2.3.8\Cake\Model\ConnectionManager.php(107): DboSource->__co

nstruct(Array)

#1 K:\wamp\www\libs\2.3.8\Cake\Console\Command\Task\ModelTask.php(900): Connecti

onManager::getDataSource('default')

#2 K:\wamp\www\libs\2.3.8\Cake\Console\Command\Task\ModelTask.php(837): ModelTas

k->getAllTables(NULL)

#3 K:\wamp\www\libs\2.3.8\Cake\Console\Command\Task\ModelTask.php(926): ModelTas

k->listAll(NULL)

#4 K:\wamp\www\libs\2.3.8\Cake\Console\Command\Task\ModelTask.php(205): ModelTas

k->getName()

#5 K:\wamp\www\libs\2.3.8\Cake\Console\Command\Task\ModelTask.php(93): ModelTask

->_interactive()

#6 K:\wamp\www\libs\2.3.8\Cake\Console\Command\BakeShell.php(108): ModelTask->ex

ecute()

#7 K:\wamp\www\libs\2.3.8\Cake\Console\Shell.php(392): BakeShell->main()

#8 K:\wamp\www\libs\2.3.8\Cake\Console\ShellDispatcher.php(200): Shell->runComma

nd(NULL, Array)

#9 K:\wamp\www\libs\2.3.8\Cake\Console\ShellDispatcher.php(68): ShellDispatcher-

>dispatch()

#10 K:\wamp\www\libs\2.3.8\Cake\Console\cake.php(51): ShellDispatcher::run(Array

)

#11 {main}

 

Database config:

 

<?php

class DATABASE_CONFIG {

 

                public $default = array(

                                'datasource' => 'Database/Postgres',

                                'persistent' => false,

                                'host' => 'localhost',

                                'port' => '5432',

                                'login' => '***',

                                'password' => '***',

                                'database' => 'postgres',

                );

}

 

Double checked the user / pass and no problems as I just created the database / logged in and out few times to make sure that was correct. PostgreSQL is active and running. Have PgAdmin running. Can login into phpPgAdmin and see the tables and data.

 

Did a phpinfo() and the PDO is there for pgsql

 

PDO

PDO support

enabled

PDO drivers

mysql, pgsql, sqlite

 

pdo_mysql

PDO Driver for MySQL

enabled

Client API version

mysqlnd 5.0.8-dev - 20102224 - $Id: 65fe78e70ce53d27a6cd578597722950e490b0d0 $

 

pdo_pgsql

PDO Driver for PostgreSQL

enabled

PostgreSQL(libpq) Version

8.3.6

Module version

1.0.2

Revision

$Id$

 

pdo_sqlite

PDO Driver for SQLite 3.x

enabled

SQLite Library

3.7.7.1

 

pgsql

PostgreSQL Support

enabled

PostgreSQL(libpq) Version

8.3.6

Multibyte character support

enabled

SSL support

disabled

Active Persistent Links

0

Active Links

0

 

Directive

Local Value

Master Value

pgsql.allow_persistent

On

On

pgsql.auto_reset_persistent

Off

Off

pgsql.ignore_notice

Off

Off

pgsql.log_notice

Off

Off

pgsql.max_links

Unlimited

Unlimited

pgsql.max_persistent

Unlimited

Unlimited

 

 

Any ideas, help would be very helpful.

 

Thanks,

Dave

No comments: