Believe it or not, this error is generated when your database connection fails. No really, it is.
To diagnose, add these lines to your code after your attempt to connect. This will tell you if your connection fails.
if (DB::isError($db)) { // Check whether the object is a connection or an error.
die($db->getMessage()); // Print out a message and exit if it's
// an error object.
}
I noticed a potential problem in your connection string. -
your connection string is missing the first portion - the type of database to which you are connecting. Posgresql connections should begin with pgsql:// while mysql connections are mysql://. This tells the DB class what type of connection to employ.