Skip to main content
Supply Chain Management forum
Suggested answer

ODBC connection on an D365 on-Premise

editSubscribe (1) ShareShare
ReportReport
Posted on by 43
Hi
 
We do have a D365 on-premise installation and need to connect to an external Database to read and write data over classes.
How can I create ODBC connections in an on-prem installation?
  • Cembrit Profile Picture
    Cembrit 43 on at
    ODBC connection on an D365 on-Premise
    Hi Navaneeth
     
    No I did not try the Marketplace thing but I did exactly the same in my code. And as mentioned in Dynamics AX2012 it works so I don't think the error is in the code but maybe in the settings on the DSN OR something on server side to block it
  • Suggested answer
    Navneeth Nagrajan Profile Picture
    Navneeth Nagrajan 1,150 on at
    ODBC connection on an D365 on-Premise
    Hi Cembrit,
     
    For ODBC Connection with D365 FO there is a Visual studio marketplace add-on that is available. Have you tried this?
     
    In the above code all you need to do is setup an ODBC Connection on the On-Premise D365 FO Machine and then add that connection string in the code highlighted in the connection string. Create a parameter for the connection string in the D365 FO system and fetch the connection string through X++ Code. 
     
  • Cembrit Profile Picture
    Cembrit 43 on at
    ODBC connection on an D365 on-Premise
    MaxTokenSize is set to maximum and from Dynamics AX2012 it works fine. Only from D365FO on-prem not
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 3,437 UG Leader on at
    ODBC connection on an D365 on-Premise
    Hi @Cembrit,

    Means the SQL Server computer was unable to process the client login packet. This may be because the packet was created improperly or because the packet was damaged during transmission. It can also be caused by the configuration of the SQL Server computer.

    As per Microsoft documentation, to resolve this problem, increase the MaxTokenSize value of the server computer, to a size large enough to contain the largest token of any user in your organization.
    Please find below documentation :
     
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Cembrit Profile Picture
    Cembrit 43 on at
    ODBC connection on an D365 on-Premise
    Yes I found the option after I posted here but then I get
     
    The login packet used to open the connection is structurally invalid; the connection has been closed. Please contact the vendor of the client library. 
     
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 3,437 UG Leader on at
    ODBC connection on an D365 on-Premise
  • Cembrit Profile Picture
    Cembrit 43 on at
    ODBC connection on an D365 on-Premise
    @Mohamed
     
    Thx I did that but do you have any idea how to setup the DSN than. Normally I would set it up with "integrated windows authentication" but if I do so I get an error :
    Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: The certificate chain was issued by an authority that is not trusted.
    [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection
     
     
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 3,437 UG Leader on at
    ODBC connection on an D365 on-Premise
    Hi @Cembrit,
     
    Plese refer to this
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Cembrit Profile Picture
    Cembrit 43 on at
    ODBC connection on an D365 on-Premise
    Sorry to come back to this post but I do not find any option in D365FO to setup a DB connector 
    WIll it be possible to write SQL Statements like 
    SQL ="SELECT [accountid],[accountnumber],[ap_AccountTypeName],[ap_Categoryidname],[ap_crmaccountid],[ap_ResponsibleidName],[name],[OwningBusinessUnit] "
            + "FROM [EDW].[CRM].[CRM365_Account] CRM365Acc "
            + "where not exists ("
            + "select * from  [EDW].[CRM].[CRM365AX_Account] CRM365AXAcc "
            + "where CRM365AXAcc.accountid = CRM365Acc.[accountid]) "
            + "AND CRM365Acc.[ap_AccountTypeName] = 'Customer'";
    I really have no clue how to solve this in D365FO (on-premise)
  • Cembrit Profile Picture
    Cembrit 43 on at
    ODBC connection on an D365 on-Premise
    @Mohamed Amine Mahmoudi If I had an idea how I would have done it ;-)

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Sundar…

Industry experts answer burning questions directly from our amazing Community…

Enabling Copilot Case and Conversation…

Agents can easily recap an ongoing chat, transcribe a voice conversation…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 282,978 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,562 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans