Lee
Lee

Reputation: 1106

Zend Db SQLITE Setup

im trying to setup sqlite as a secondary adapter and have run into a problem.

I am getting the following message:

Message: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'reports.reports' doesn't exist

My code for the table is:

class Table_Reports extends Zend_Db_Table_Abstract {
protected $_name = 'reports';
protected $_id = 'report_id';
protected $_rowClass = 'Model_Report';
protected $_adapter = 'dbReports';
protected $_schema = 'reports';

}

If i change the $_schema to blank then it tries to use my primary mysql database.

My app config is:

resources.multidb.db1.adapter = "PDO_MYSQL"
resources.multidb.db1.host = "localhost"
resources.multidb.db1.dbname = "test"
resources.multidb.db1.username = "root"
resources.multidb.db1.password = ""
resources.multidb.db1.isDefaultTableAdapter = true

resources.multidb.db2.adapter = "PDO_SQLITE"
resources.multidb.db2.dbname = ROOT "/data/reports.db"

Anyone know whats going on?

Thanks

I have turned on Profiling however as far as i can tell nothing is being queried as the error occurs when i run:

$reports = new Table_Reports();
$reportRow = $reports->createRow();

Upvotes: 4

Views: 873

Answers (2)

Lee
Lee

Reputation: 1106

I have managed to sort this problem out.

The adapter was using the mysql user and password details to try and connect to sqlite so i have had to force the adapter to change over like so:

public function __construct($config = array())
{
    $this->_setAdapter(Zend_Registry::get('dbReports'));
    parent::__construct($config);
}

This is in the file class Table_Reports

Upvotes: 0

salgua
salgua

Reputation: 698

Try using APPLICATION_PATH and relative path instead ROOT. Maybe you have open_basedir restriction or authorization problem

Upvotes: 2

Related Questions