4

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();
1
  • Please try turning on query profiling, which will enable you to get the actual executed SQL. From that, we can determine exactly what's going wrong. I'm going to speculate that an ALTER TABLE is being run when it shouldn't. Commented Mar 11, 2011 at 21:04

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.