title: Fatal error on /app/code/core/Mage/Core/Model/Resource/Resource.php in Magento
body: <p>Just upgraded a Magento install from 1.5 to 1.6, and left with this error:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function insert() on a non-object in
    /hsphere/local/home/t21004/XXXXXXXXXXXXX.com/app/code/core/Mage/Core/Model/Resource/Resource.php
    on line 133</p>
  </blockquote>
  
  <p>The contents of line 133 are as below:</p>
  
  <pre><code> return $this-&gt;_getWriteAdapter()-&gt;insert($this-&gt;getMainTable(), $dbModuleInfo);
  </code></pre>
  
  <hr>
  
  <p>config.xml :</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;
  &lt;!--
  /**
   * Magento
   *
   * NOTICE OF LICENSE
   *
   * This source file is subject to the Academic Free License (AFL 3.0)
   * that is bundled with this package in the file LICENSE_AFL.txt.
   * It is also available through the world-wide-web at this URL:
   * http://opensource.org/licenses/afl-3.0.php
   * If you did not receive a copy of the license and are unable to
   * obtain it through the world-wide-web, please send an email
   * to license@magentocommerce.com so we can send you a copy immediately.
   *
   * DISCLAIMER
   *
   * Do not edit or add to this file if you wish to upgrade Magento to newer
   * versions in the future. If you wish to customize Magento for your
   * needs please refer to http://www.magentocommerce.com for more information.
   *
   * @category    Mage
   * @package     Mage_Core
   * @copyright   Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
   * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
   */
  --&gt;
  &lt;config&gt;
      &lt;global&gt;
          &lt;install&gt;
              &lt;date/&gt;
          &lt;/install&gt;
          &lt;resources&gt;
              &lt;default_setup&gt;
                  &lt;connection&gt;
                      &lt;host&gt;localhost&lt;/host&gt;
                      &lt;username/&gt;
                      &lt;password/&gt;
                      &lt;dbname&gt;magento&lt;/dbname&gt;
                      &lt;model&gt;mysql4&lt;/model&gt;
                      &lt;initStatements&gt;SET NAMES utf8&lt;/initStatements&gt;
                      &lt;type&gt;pdo_mysql&lt;/type&gt;
                      &lt;active&gt;0&lt;/active&gt;
                  &lt;/connection&gt;
              &lt;/default_setup&gt;
              &lt;default_write&gt;
                  &lt;connection&gt;
                      &lt;use&gt;default_setup&lt;/use&gt;
                  &lt;/connection&gt;
              &lt;/default_write&gt;
              &lt;default_read&gt;
                  &lt;connection&gt;
                      &lt;use&gt;default_setup&lt;/use&gt;
                  &lt;/connection&gt;
              &lt;/default_read&gt;
              &lt;core_setup&gt;
                  &lt;setup&gt;
                      &lt;module&gt;Mage_Core&lt;/module&gt;
                  &lt;/setup&gt;
                  &lt;connection&gt;
                      &lt;use&gt;default_setup&lt;/use&gt;
                  &lt;/connection&gt;
              &lt;/core_setup&gt;
              &lt;core_write&gt;
                  &lt;connection&gt;
                      &lt;use&gt;default_write&lt;/use&gt;
                  &lt;/connection&gt;
              &lt;/core_write&gt;
              &lt;core_read&gt;
                  &lt;connection&gt;
                      &lt;use&gt;default_read&lt;/use&gt;
                  &lt;/connection&gt;
              &lt;/core_read&gt;
          &lt;/resources&gt;
          &lt;resource&gt;
              &lt;connection&gt;
                  &lt;types&gt;
                      &lt;pdo_mysql&gt;
                          &lt;adapter&gt;Varien_Db_Adapter_Pdo_Mysql&lt;/adapter&gt;
                          &lt;class&gt;Mage_Core_Model_Resource_Type_Db_Pdo_Mysql&lt;/class&gt;
                          &lt;compatibleMode&gt;1&lt;/compatibleMode&gt;
                      &lt;/pdo_mysql&gt;
                  &lt;/types&gt;
              &lt;/connection&gt;
          &lt;/resource&gt;
          &lt;models&gt;
              &lt;varien&gt;
                  &lt;class&gt;Varien&lt;/class&gt;
              &lt;/varien&gt;
              &lt;core&gt;
                  &lt;class&gt;Mage_Core_Model&lt;/class&gt;
                  &lt;resourceModel&gt;core_resource&lt;/resourceModel&gt;
              &lt;/core&gt;
              &lt;core_resource&gt;
                  &lt;class&gt;Mage_Core_Model_Resource&lt;/class&gt;
                  &lt;deprecatedNode&gt;core_mysql4&lt;/deprecatedNode&gt;
                  &lt;entities&gt;
                      &lt;config_data&gt;
                          &lt;table&gt;core_config_data&lt;/table&gt;
                      &lt;/config_data&gt;
                      &lt;website&gt;
                          &lt;table&gt;core_website&lt;/table&gt;
                      &lt;/website&gt;
                      &lt;store&gt;
                          &lt;table&gt;core_store&lt;/table&gt;
                      &lt;/store&gt;
                      &lt;resource&gt;
                          &lt;table&gt;core_resource&lt;/table&gt;
                      &lt;/resource&gt;
                      &lt;cache&gt;
                          &lt;table&gt;core_cache&lt;/table&gt;
                      &lt;/cache&gt;
                      &lt;cache_tag&gt;
                          &lt;table&gt;core_cache_tag&lt;/table&gt;
                      &lt;/cache_tag&gt;
                      &lt;cache_option&gt;
                          &lt;table&gt;core_cache_option&lt;/table&gt;
                      &lt;/cache_option&gt;
                  &lt;/entities&gt;
              &lt;/core_resource&gt;
          &lt;/models&gt;
      &lt;/global&gt;
      &lt;default&gt;
          &lt;system&gt;
              &lt;filesystem&gt;
                  &lt;base&gt;{{root_dir}}&lt;/base&gt;
                  &lt;app&gt;{{root_dir}}/app&lt;/app&gt;
                  &lt;code&gt;{{app_dir}}/code&lt;/code&gt;
                  &lt;design&gt;{{app_dir}}/design&lt;/design&gt;
                  &lt;locale&gt;{{app_dir}}/locale&lt;/locale&gt;
                  &lt;etc&gt;{{app_dir}}/etc&lt;/etc&gt;
                  &lt;media&gt;{{root_dir}}/media&lt;/media&gt;
                  &lt;upload&gt;{{root_dir}}/media/upload&lt;/upload&gt;
                  &lt;skin&gt;{{root_dir}}/skin&lt;/skin&gt;
                  &lt;var&gt;{{var_dir}}&lt;/var&gt;
                  &lt;cache&gt;{{var_dir}}/cache&lt;/cache&gt;
                  &lt;session&gt;{{var_dir}}/session&lt;/session&gt;
                  &lt;tmp&gt;{{var_dir}}/tmp&lt;/tmp&gt;
                  &lt;pear&gt;{{var_dir}}/pear&lt;/pear&gt;
                  &lt;export&gt;{{var_dir}}/export&lt;/export&gt;
              &lt;/filesystem&gt;
          &lt;/system&gt;
          &lt;general&gt;
              &lt;locale&gt;
                  &lt;code&gt;en_US&lt;/code&gt;
                  &lt;timezone&gt;America/Los_Angeles&lt;/timezone&gt;
              &lt;/locale&gt;
          &lt;/general&gt;
      &lt;/default&gt;
      &lt;varien&gt;
          &lt;class&gt;Varien&lt;/class&gt;
      &lt;/varien&gt;
  &lt;/config&gt;
  </code></pre>
  
  <p>and local.xml :</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!--
  /**
   * Magento
   *
   * NOTICE OF LICENSE
   *
   * This source file is subject to the Academic Free License (AFL 3.0)
   * that is bundled with this package in the file LICENSE_AFL.txt.
   * It is also available through the world-wide-web at this URL:
   * http://opensource.org/licenses/afl-3.0.php
   * If you did not receive a copy of the license and are unable to
   * obtain it through the world-wide-web, please send an email
   * to license@magentocommerce.com so we can send you a copy immediately.
   *
   * DISCLAIMER
   *
   * Do not edit or add to this file if you wish to upgrade Magento to newer
   * versions in the future. If you wish to customize Magento for your
   * needs please refer to http://www.magentocommerce.com for more information.
   *
   * @category   Mage
   * @package    Mage_Core
   * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
   * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
   */
  --&gt;
  &lt;config&gt;
      &lt;global&gt;
          &lt;install&gt;
              &lt;date&gt;&lt;![CDATA[Tue, 26 Apr 2011 15:59:54 +0000]]&gt;&lt;/date&gt;
          &lt;/install&gt;
          &lt;crypt&gt;
              &lt;key&gt;&lt;![CDATA[XXXXXXXXXXXXXXXXXXXXXXXXXXXX]]&gt;&lt;/key&gt;
          &lt;/crypt&gt;
          &lt;disable_local_modules&gt;false&lt;/disable_local_modules&gt;
          &lt;resources&gt;
              &lt;db&gt;
                  &lt;table_prefix&gt;&lt;![CDATA[]]&gt;&lt;/table_prefix&gt;
              &lt;/db&gt;
              &lt;default_setup&gt;
                  &lt;connection&gt;
                      &lt;host&gt;&lt;![CDATA[XXXXXXXXX]]&gt;&lt;/host&gt;
                      &lt;username&gt;&lt;![CDATA[XXXXXXXXXX]]&gt;&lt;/username&gt;
                      &lt;password&gt;&lt;![CDATA[XXXXXXXXXX]]&gt;&lt;/password&gt;
                      &lt;dbname&gt;&lt;![CDATA[XXXXXXX]]&gt;&lt;/dbname&gt;
                      &lt;active&gt;1&lt;/active&gt;
                  &lt;/connection&gt;
              &lt;/default_setup&gt;
          &lt;/resources&gt;
          &lt;session_save&gt;&lt;![CDATA[files]]&gt;&lt;/session_save&gt;
      &lt;/global&gt;
      &lt;admin&gt;
          &lt;routers&gt;
              &lt;adminhtml&gt;
                  &lt;args&gt;
                      &lt;frontName&gt;&lt;![CDATA[admin]]&gt;&lt;/frontName&gt;
                  &lt;/args&gt;
              &lt;/adminhtml&gt;
          &lt;/routers&gt;
      &lt;/admin&gt;
  &lt;/config&gt;
  </code></pre>