Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 83468

How to connect from Mendix Cloud to Azure SQL Database?

$
0
0
Hello, I am trying to execute an INSERT statement on an Azure (cloud) SQL Database from my Mendix application using an Active Directory (AD) enabled account, but I can’t get it to work. Background: I am using the database connector module from the app store to connect to Azure SQL. When using a non-AD account, I am able to connect and execute statements on Azure SQL without a problem. But, when using an AD account on the same database, it fails to connect. I have connected to this Azure SQL Database using the AD account through SQL Server Management Studio and I’m able to execute queries just fine, but i can’t get it to work when I try to connect from my Mendix application. My first thought was to create a new Java Action add it to the Database Connector module to handle connecting AD accounts to Azure SQL. I am following this tutorial from Microsoft Docs using authentication type ActiveDirectoryPassword. In the Java Code, Along with the code found in the tutorial, I have ds.setAuthentication("ActiveDirectoryPassword"), ds.setEncrypt(true), and ds.setTrustServerCertificate(true); I am also using mssql-jdbc-7.2.1.jre8.jar as the JDBC driver and I have placed azure-activedirectory-library-for-java library and all dependencies in my projects userlib folder. I get the following error when I try to execute my statement while using an AD account: com.microsoft.aad.adal4j.AuthenticationException - org.apache.commons.lang3.StringEscapeUtils.escapeXml10(Ljava/lang/String;)Ljava/lang/String; ------ <INSERT STATEMENT HERE> ------ com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: Failed to authenticate the user <USERNAME> in Active Directory (Authentication=ActiveDirectoryPassword). at com.mendix.basis.component.InternalCoreBase.execute(InternalCoreBase.java:418) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: Failed to authenticate the user <USERNAME> in Active Directory (Authentication=ActiveDirectoryPassword). at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:159) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Failed to authenticate the user <USERNAME> in Active Directory (Authentication=ActiveDirectoryPassword). at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36) Caused by: Failed to authenticate the user <USERNAME> in Active Directory (Authentication=ActiveDirectoryPassword). Note: I have replaced some text in the error log in “<>” brackets . There is also more to the error log. I can paste the entire log if needed.   Does anyone have any insight on this issue? I’m also open to alternative solutions. Thanks.

Viewing all articles
Browse latest Browse all 83468

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>