preloader-matrix

Alfasith

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

Hi,

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 (resultSet.next())
    {
        metaData = resultSet.getMetaData();
        while (i)
        {
            info(“Column Name :”+metaData.getColumnName(i)+ ” Value = “+resultSet.getString(i));
            i++;
        }
    }
}

Regards,

Leave a Reply

Your email address will not be published.