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.

1 Answer 1

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.

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

Your Answer

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

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