Hi,
This applies to Retool self-hosted...
Following on from this discussion: Is it possible to connect and build CRUD tables for Microsoft Fabric Data Warehouse using Retool?
I'm writing this post to share my own, now successful, experience in connecting to a MS Fabric SQL endpoint using the JDBC connector and including AzureAD (now Entra), authentication.
This example is using AAD/Entra username and password, but using other connection string options, I believe you can also use the same method to connect using Service Principle accounts.
First, you must ensure JDBC is setup and you've mapped your paths properly. I won't go into the whole thing because it's documented on Retool's docco here:
What I would say, is there is a slight tweak where it mentions adding volume mappings:
- `./jdbc:/retool_backend/jdbc`
You don't need the " ' " so it should be:
- ./jdbc:/retool_backend/jdbc
Once you have setup the volume mappings and the environment variable, you need the right .JAR files and their dependencies...
I used a tool called DBVizualiser which helped me work out which ones I needed, in the end I brought over a whole load.
The core driver .JAR for MSSQL you need is:
mssql-jdbc-12.2.0.jre11.jar
And the listed dependencies to get the authentication working is:
accessors-smart-2.4.9.jar
asm-9.3.jar
content-type-2.2.jar
jackson-annotations-2.13.4.jar
jackson-core-2.13.4.jar
jackson-databind-2.13.4.2.jar
javamsalruntime-0.13.10.jar
jcip-annotations-1.0-1.jar
jna-5.12.1.jar
jna-platform-5.12.1.jar
json-smart-2.4.10.jar
lang-tag-1.7.jar
msal4j-1.14.3-beta.jar
msal4j-brokers-1.0.3-beta.jar
nimbus-jose-jwt-9.30.2.jar
oauth2-oidc-sdk-10.7.1.jar
slf4j-api-1.7.36.jar
Once you have copied them into your /jdbc
folder and reloaded your Retool application containers, you should be able to connect to Azure/Fabric SQL using a JDBC Resource and connection string similar to:
jdbc:sqlserver://<servername>.datawarehouse.pbidedicated.windows.net:1433;DatabaseName=<dbname>;authentication=ActiveDirectoryPassword;UserName=<user>;Password=<password>;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.datawarehouse.pbidedicated.windows.net;
(the servername and domain info will need to match whatever resource you're connecting to, datawarehouse.pbidedicated.windows.net is what Fabric SQL endpoints use).
As I say, if you want to use other AAD/Entra authentication methods, like a Service Principle, you'll have to tweak the connection string accordingly.
This worked for me, I hope it works for you.
Thanks
Dave