0

I am creating an ODBC connection to Import data from SQL (SSMS) to D365FO.

I have created a Test database and created an ODBC Data Source for it (DSN: TestDS, Server: local, Default database: TestDB).

Running SQL Server ODBC Data Source Test works fine:

Running connectivity tests...

Attempting connection
Connection established
Verifying option settings
Disconnecting from server

TESTS COMPLETED SUCCESSFULLY!

The Server Browser is running, class runOn server is set.

Here is a piece of my code:

public server static void main(Args _args)
{        
    OdbcConnection  con;
    LoginProperty   loginProp;

    loginProp = new LoginProperty();
    loginProp.setDSN("TestDS");

    con = new OdbcConnection(loginProp);
}

In the debugging window it throws me the following error:

"Object 'OdbcConnection' could not be created"

On the user side I am getting the following errors:

"ODBC operation failed. Unable to log on to the database."
"Unable to retrieve message for retval -1, ODBC call reason code -2, SQLSTATE = []"

As I know, ODBC for data import hasn't been yet supported in 2016. Is it supported now? I have found the exactly similar standard AX7 code, but I am not able to test if it works in standard.

Anybody had something similar to this and got it solved?

Effy Sille
  • 179
  • 1
  • 12
  • 1
    Do I understand correctly that you're doing that on a development box? Do you realize that you won't be able to add the data source in Microsoft hosted environments? It doesn't look like viable architecture. When talking about ODBC support, I suspect you mean Data Management, which isn't related to your code. – Martin Dráb Oct 30 '18 at 17:36
  • What is your target? Why do you need an ODBC connection? Did you consider using [data entities](https://learn.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/data-entities/data-entities)? – Il Vic Oct 31 '18 at 08:23

0 Answers0