2
votes

In AX2012 I want to build an ODBC database connection to SQL Server 2008R2. Therefor I build the 32 Bit System-DSN ‘SQL Server Native Client 10.0’ (C:\Windows\SysWOW64\odbcad32.exe).

If I start the following code as job or directly in a button of a form, the connection to the database is correct.

{
    LoginProperty                   loginProperty;
    OdbcConnection                  myConnection1;
    Statement                       myStatement;
    SqlStatementExecutePermission   perm;
    str                             _query;
    ResultSet                       result;
    str                             retVal;
    ;

    #macrolib.ocMegaBoard

    loginProperty = new LoginProperty();
    loginProperty.setDSN( #OCDSN );

    myConnection1 = new OdbcConnection( loginProperty );
    info('OK');
}

If I start the same code as part of different procedure calls, the following error message is coming: ‘[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application‘

Please, can you help me?

1
Is the different procedure call executing on the server and not on the client (or vice-versa)? This would only occur if you creaded the DSN on both machines of course. - ian_scho

1 Answers

3
votes

Similar problems have been reported elsewhere.

Most likely your code works when executed by the client (32-bit), but fails when executed on the server AOS (64-bit). Just be sure to define your DSN on your AOS server as well, here as 64-bit.