How to connect to external db without DSN ? ax 2012

Hello,

I need to connect with external data base in ax 2012. In 2009 i was using ADO and it was great.

I was searching internet about my problem and everywhere is the solution with setting a DSN. Its not acceptable because a don’t want to set on any client the DSN (code will be executing on server and sometimes on client). Do you know any possibilities to resolve my problem ? I’m thinking about .net but I dont test it yet.

The support for ODBC is included in AX, nevertheless I also see many reasons why not to use it. You have many great frameworks in .NET - you can, for example, create a class library utilizing LINQ to SQL, add the library to AOT and call it via .NET Interop from X++.

it’s possible to use for example System.Data.SqlClient.SqlConnection or I have to use Visual Studio Projects?? Im asking beceause i tried to use the first solution but ax doesn’t see an external db probably.

Thank u for help.

Of course, you can use .NET Interop from X++ directly, although it’s generally easier to encapsulate complex logic in a separate library (facade). It doesn’t matter whether you execute the code from X++ or from another .NET code.