web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Connection string of SQL server staging database to d365 on premise

(0) ShareShare
ReportReport
Posted on by 434

I want to know how connect to staging database created in SQL server of same domain in which d365 for finance and operations is installed.

Now I want to pull data from staging database tables

And push data from d365 to staging database tables.

Please help me.. this is my first d365 project

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Trying to put data directly to AX database behind AX backs wouldn't be a wise approach. Use data entities instead, either through files or web services.

  • rajeev tiwari Profile Picture
    434 on at

    Hello sukrut,

    I am not using dixf...

    I have staging database in SQL server .. from this database tables I have to read record using x++ and insert/update in d365 tables through classes.

    For that I need connection string to connect to SQL server staging database from d365 class.

  • rajeev tiwari Profile Picture
    434 on at

    I have staging database in SQL server .. from this database tables I have to read record using x++ and insert/update in d365 tables through classes.

    For that I need connection string to connect to SQL server staging database from d365 class

    I'm not pushing directly to database..I will use x++ classes for that I am asking connection string

  • Suggested answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Aha, so you want to do it from AX. While using OdbcConnection class (as mentioned by Skurut) is possible, I wouldn't do it except of maybe some trivial cases. .NET offers much easier and safer ways - you can generate classes from schema of the database and use classes and method in strongly-typed way, which completely removes whole classes of errors. You can see one possible way in my blog post Connection to external database. It was for AX 2012; working with other VS projects is even easier in AX 7.

    An even better solution would be using Data Import Export Framework with ODBC, but it's still not implemented, as far as I know.

  • rajeev tiwari Profile Picture
    434 on at

    Hello Martin,

    Thanks for your suggestion ..

    Which is the best way to read data from SQL Server Staging Database.

    I am using D365 on Premise.

    Thanks 

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    To make it clearer, data import and export, including recurring integrations is supported. I meant only the ODBC source when talking about an unsupported feature.

    I can't answer what is the best way, because there simply isn't a single best way for all possible scenarios. I would consider several different options. Some of them are mentioned above, some would question your previous decisions such as "using x++".

  • rajeev tiwari Profile Picture
    434 on at

    I am trying to connect SQL Database from D365 (on premise)  but I am not able to connect to SQL Database , It is giving exception message,

    Microsoft.Dynamics.Ax.Xpp.InternalException was unhandled by user code

    Message: An exception of type 'Microsoft.Dynamics.Ax.Xpp.InternalException' occurred in AOSKernel.dll but was not handled in user code

    Additional information: Object 'OdbcConnection' could not be created

    I have written code for testing connection: Please suggest how to connect. 

    public static void main(Args _args)
    {

    LoginProperty loginProp;
    ODBCConnection conn;
    Resultset resultSet, resultSetCount;
    Statement statement1, statement2;
    ;

    loginProp = new LoginProperty();

    loginProp.setServer("MININT-TE88M28");
    loginProp.setDatabase("Test");

    conn = new ODBCConnection(loginProp);

    statement1 = conn.createStatement();
    resultSet = statement1.executeQuery("SELECT * from item");

    while (resultSet.next())
    {
    info(resultSet.getString(1));
    }
    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans