Skip to main content

Notifications

Supply chain | Supply Chain Management, Commerce
Suggested answer

ODBC connection on an D365 on-Premise

Posted on by 49
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 49 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,434 Super User 2024 Season 2 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 49 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 9,413 Super User 2024 Season 2 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 49 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 9,413 Super User 2024 Season 2 on at
    ODBC connection on an D365 on-Premise
  • Cembrit Profile Picture
    Cembrit 49 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 9,413 Super User 2024 Season 2 on at
    ODBC connection on an D365 on-Premise
    Hi @Cembrit,
     
    Plese refer to this
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Cembrit Profile Picture
    Cembrit 49 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 49 on at
    ODBC connection on an D365 on-Premise
    @Mohamed Amine Mahmoudi If I had an idea how I would have done it ;-)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans