Access the other instance DB belongs to same domain but different DB in AX


static void AlfasithOtherDBAccess(Args _args)
    LoginProperty       loginProp;
    ODBCConnection      conn;
    Resultset           resultSet, resultSetCount; // get record
    Statement           statement1, statement2; // Create SQL Statement
    ResultSetMetaData   metaData ; // get Record metadate like columnname.
    RetailTillLayout    RetailTillLayout;
    int i = 1;

    // Set Server Database
    loginProp = new LoginProperty();
    loginProp.setServer(‘DNWADY0046L’); // System or  server name
    loginProp.setDatabase(‘MicrosoftDynamicsAX’); // instance DB name like MicrosoftDynamicsAX_Live

    // Create Connection and SQL Statement
    conn = new ODBCConnection(loginProp);
    statement1 = conn.createStatement();
    resultSet = statement1.executeQuery(“SELECT TOP 1 * from [MicrosoftDynamicsAX].[dbo].[RetailTillLayout]”);

    while (
        metaData = resultSet.getMetaData();
        while (i)
            info(“Column Name :”+metaData.getColumnName(i)+ ” Value = “+resultSet.getString(i));


Share on email
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

Leave a Reply

Your email address will not be published.