Querying SQL databases in X++


I created a ‘System DSN’ to connect to an outside database in Dynamics AX 2009. In my DSN setup, I specify a username and password. I tested the DSN connection and it worked succesfully.

The issue is that even though I specify the DSN in my LoginProperty object, when I try to connect, I get a connection error because the AOS service account does not have permission to connect to the SQL database. This is confusing because I am not specifying to use the service account to login and I have already specified a working username and password in the DSN.

How can I ensure that my DSN’s username and password are being used and not the AOS service account?

Thank you

Try to use sql server authentication and then specify username and password for database connection.