Direct DB Connections via Connection Manager | Changing Port #s

Hi folks,

I have a client that uses Sage 50 (2018.1 + Connection Manager v7.0).  They host Sage on a MS Azure server.  They have 6 Companies (DBs) that I'd like to be able to connect to so that I can pull some high-level data into a custom reporting tool we are creating.

I've come close to the right setup: I've setup a user with 3rd Party Products access (with shortened password). 

With MySQL Workbench I can make a successful connection to: the.server.ip.addy:13541 etc by looking up the port assigned to each company via the Sage 50 application.

I thought I was in the clear, but as some of you know the port numbers are dynamically assigned, not hard coded as discussed here in the past:

I haven't been able to find any recent discussions on this topic.  Is my assumption correct that the situation hasn't changed?  I figure I can't be the 1st person to want to be able to do this type of connection to multiple companies on the same server via Connection Manager.  

I see the folks over at Logic IM are charging $100 for the KeepAlive service that is mentioned in a few older threads:

I'm hoping to be able to touch base with someone who is running this type of setup.  Even if KeepAlive is the only way, that is fine, I'd just like to be able to bounce some questions off anyone doing it that way.

thanks in advance!


JGR Tech

  • Thanks Randy, do the Excel Sheets reports come with the sdk?  I'm not seeing them in what I downloaded.  Having trouble getting the C# examples probably opened in my environment so going to take a look at the Excel stuff.

  • JasonR said:
    do the Excel Sheets reports come with the sdk?


    I'm not sure they're in every Edition, usually they're installed with the Sage 50 workstation software, in the Reports folder, and can be found on the Reports menu.

  • Still tackling this connectivity issue.  I've copied the VB.NET example and am trying to run this:

    szUsername = "myUsername"

    szPassword = "myPassword"

    szHost = "the.server.ip.address"

    szPort = ""  --> tried blank, 13540, 13531 etc

    szFileDir = "E:\Simply\CompanyFolder\Company Corporation.saj"

    dbError = dbClient.GetConnectionInfo(szFileDir, szHost, szPort)

    The error I get back from dbClient.GetConnectionInfo is "Error_ConnectionMgr_None".

    Perhaps I'm not understanding how the connection works.  Our server is an Azure VM so I don't have access to szFileDir from my local PC.  It's unclear from the SDK docs if you need to have access to this from the client PC or if it's passed to the ConnectionManager and dealt with up on the server to return the port #.  I'm running this code from my local PC.

    Having said all this, I can connect to one of the company DBs via MySQL Workbench using the.server.ip.address:XXXXX - provided I look up the port number of the company DB I want to connect to.

    So I must be close.

    I've contemplated just making direct MySQL connections starting with port 13540, reading something from the DB that I connect to that would indicate which one I'm in (company name etc), doing my work (exporting data) and moving on to the next port to connect to the next DB.  We have 6 to connect to...

  • Yes, that saj file is a config file.

    So in this case, that is a standard windows file in a standard file location. The users running sage 50 when they launch sage ALSO will have use of that .saj file, and they have use via a standard windows resolved path name.

     So like any pdf, or any other kind of file that you specify a full path name to, it is assumed that users have full rights and use of that file in a standard windows folder.

    So when users launch sage, they must have full use of that .saj file that is sitting in standard windows folder. Without use of that file, then you can't launch sage. And same goes for your software - you launch your software, then again you need use of that file just like any sage user does.


    Albert D. Kallal

    Edmonton, Alberta Canada

    [email protected]

  • Thanks for that explanation.  Sage 50 is hosted on an Azure VM and the code doing the export won't be on the same server so that type of connection is out for me.

    What I've done for the time being is written a app to cycle through a list of ports:

    {"13540", "13541", "13542", "13543", "13544", "13545"} etc...

    ...and attempting to connect.  When it does connect I check the Company Name...

    "SELECT sCompName FROM tCompany"

    ...Then I know what DB I'm in since the company name is unique in my case.  Then I just do my SELECT * from the 5 tables I need and dump the data to file and move on.