DB Connection succeeds for one model, but fails for second model


Hi all

We have a project which has a number of db connections. In one model, we have a database connection, and I’m able to query, create rows, etc just fine.

I enter a different model, which references a different table on the same database connection, and when I try a very basic query:

$this->ModelName->find('all', [] ); 

And I get an error:

A Database connection using "DatabaseName" was missing or unable to connect.
SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (SQLVM-ADAM.local) (severity 9)

How would you go about troubleshooting this? I’m stumped.



And you used $this->loadModel ?:

example in AdminsController:

$all_users = $this->Users->find();



Yep, a loaded the model.

In the end I got the datasource from the working model and called fetchAll on that.

Very strange.


you can bring all the code of the action in which it happens, so that I looking… ?