2

I am trying to pull information from an external mssql database for extra product information and display them on the product view page.

I have read other similar posts, but they are for mysql only and not complete. I am using Magento 1.9, Ubuntu 15.04.

Thanks in advance.

2

This is exactly what you need. You can define multiple database connections in your config.xml

<!-- osCommerce db/read/write -->
<oscommercedb>
    <connection>
        <host>localhost</host>
        <username>root</username>
        <password>pass</password>
        <dbname>oscommerce_database_name</dbname>
        <model>mysql4</model>
        <initstatements>SET NAMES utf8</initstatements>
        <type>pdo_mysql</type>
        <active>1</active>
    </connection>
</oscommercedb>
<oscommercedb_write>
    <connection>
        <use>oscommercedb</use>
    </connection>
</oscommercedb_write>
<oscommercedb_read>
    <connection>
        <use>oscommercedb</use>
    </connection>
</oscommercedb_read>
<!-- end osCommerce db -->

and then simply call the resource like this

$read = Mage::getSingleton('core/resource')->getConnection('oscommercedb');

In the original answr you will find some more info, but it is possible at least.

  • This isn't MSSQL – Steve Robbins Jul 8 '15 at 22:55
  • Right. Have you tried it at least or searched the allowed <type>? – mbalparda Jul 8 '15 at 23:57
  • No, but I notice your example uses pdo_mysql which doesn't seem correct. Is that type compatible? – Steve Robbins Jul 9 '15 at 1:41

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.