I develop a module with custom connection to custom database, and i'm using it through Mage_Core_Model_Abstract, Collection etc. But in exception.log i see

Exception message: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dbname.table_prefix_tablename' doesn't exist

But my custom db doesn't have a table prefix. I've tryed to override table_prefix


but it doesn't work. What can i do?


try write install script

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */


  CREATE TABLE IF NOT EXISTS {$this->getTable('test')} (
  `language_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `country` varchar(255) NOT NULL DEFAULT '',
  `language` varchar(255) NOT NULL,
  `description`varchar(255) NOT NULL,
  PRIMARY KEY (`language_id`),
  UNIQUE KEY `locale` (`country`,`language`)
  • but i'm working with a custom db. I don't need alter tables – giovanni Feb 6 '14 at 10:08
  • you put create table syntax. it simple – Keyul Shah Feb 6 '14 at 10:09
  • See I update my code – Keyul Shah Feb 6 '14 at 10:11
  • i see, and so this installer writes in my custom db through config.xml connection? – giovanni Feb 6 '14 at 10:20
  • yes that way. :) – Keyul Shah Feb 6 '14 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.