Support » Fixing WordPress » Connecting to external SQL Server with a plugin

  • Resolved Joe Casabona


    Hello! I’m trying to connect to a separate SQL Server Database from within my plugin (the data is already in that database) so I am trying to do so this way:

    $dbh= mssql_connect($host, $user, $password) or die ('I cannot connect to the database because: ' . mssql_get_last_message());
    		mssql_select_db($database) or die ('I cannot connect to the table because: ' . mssql_get_last_message());

    However, I’m getting an unable to connect error. When I run the same code outside of a wordpress plugin in the wordpress directory, I connect fine and can display the data.

    Does WordPress have some option I need to enable to connect to a different database not using $wpdb? Is it blocked completely?



Viewing 1 replies (of 1 total)
  • Joe Casabona


    Update: there is no issue. It was a variable issue due to tired eyes.

    So for future reference- you should be able to connect to an external SQL Server within a WordPress plugin with no problems, assuming you have the proper DLL installed.

Viewing 1 replies (of 1 total)
  • The topic ‘Connecting to external SQL Server with a plugin’ is closed to new replies.