title: Connect to another database in custom module
body: <p>I have created a new module <strong>forumprodposts</strong> in its config.xml file I have added the below xml. In controller I have added this code</p>
  
  <pre><code>$sql    = "SELECT * FROM comments";
  $conn   = Mage::getSingleton('core/resource')-&gt;getConnection('forumprodposts_read');
  $data   = $conn-&gt;fetchAll($sql);
  </code></pre>
  
  <p>But the above code throws error that comments is not a table of the core database. I think in my xml there is some mistake, so connection to the <strong>prodcomments</strong> database is not establishing.</p>
  
  <pre><code>&lt;resources&gt;
      &lt;forumprodposts_write&gt;
          &lt;connection&gt;
              &lt;use&gt;prodcomments_database&lt;/use&gt;
          &lt;/connection&gt;
      &lt;/forumprodposts_write&gt;
      &lt;forumprodposts_read&gt;
          &lt;connection&gt;
              &lt;use&gt;prodcomments_database&lt;/use&gt;
          &lt;/connection&gt;
      &lt;/forumprodposts_read&gt;
      &lt;forumprodposts_setup&gt;
          &lt;connection&gt;
              &lt;use&gt;core_setup&lt;/use&gt;
          &lt;/connection&gt;
      &lt;/forumprodposts_setup&gt;
      &lt;forumprodposts_database&gt;
          &lt;connection&gt;
              &lt;host&gt;&lt;![CDATA[localhost]]&gt;&lt;/host&gt;
              &lt;username&gt;&lt;![CDATA[username]]&gt;&lt;/username&gt;
              &lt;password&gt;&lt;![CDATA[password]]&gt;&lt;/password&gt;
              &lt;dbname&gt;&lt;![CDATA[prodcomments]]&gt;&lt;/dbname&gt;
              &lt;model&gt;mysql4&lt;/model&gt;
              &lt;type&gt;pdo_mysql&lt;/type&gt;
              &lt;active&gt;1&lt;/active&gt;
          &lt;/connection&gt;
      &lt;/forumprodposts_database&gt;
  &lt;/resources&gt;
  </code></pre>