Forum Discussion

joso1's avatar
joso1
New Contributor
5 years ago

ReadyAPI connectivity to Azure SQL

 Any pointers to configure Azure SQL with ReadyAPI. I am getting the following error on the below connection string:

 

groovy code:

 

def db = [url:"jdbc:sqlserver://" + serverName+ ":" + serverPort + ";databaseName=" + dbName + ";authentication=ActiveDirectoryPassword", driver:"com.microsoft.sqlserver.jdbc.SQLServerDriver", user:"uname"]

 

def connection = Sql.newInstance(db.url, db.user, db.driver)

 

jdbc:sqlserver://<serrver_name>:1433;databaseName=<db-name>;authentication=ActiveDirectoryPassword

 

Thu Dec 10 12:34:25 AEDT 2020: ERROR: Could not connect to the database: com.microsoft.sqlserver.jdbc.SQLServerException: Failed to load ADAL4J Java library for performing ActiveDirectoryPassword authentication.

 

Tried to add the adal4j jar to ready api but no luck with that too:

 

  • Hey joso1,

    I did a bit of googling and for some versions of the adal jar there were missing dependencies, so you might want to check this isnt a problem with your version of the .jar file.

    Stackoverflow link: https://stackoverflow.com/questions/52270540/not-able-to-get-azure-token-using-adal4j-api

    I know youre trying to connect using groovy, but when i try and setup new db connections using jdbc in ReadyAPI!, quite often if im having problems i'll try and setup the connection in a db interrogation tool first (removing some of the complication) like say DBVisualiser/TOAD etc. The JDBC config required in the db tools is identical to ReadyAPI! so doing it this way i at least know that the jdbc connection string parameters are correct (as they can change based on how the db is setup) which is most of the problem to be resolved. Once ive got my connection setup in the db tools i then know if i replicate the settings in ReadyAPI! and it doesnt work, the problem cant be incorrect driver .jar nor incorrect jdbc connection url and that it has gotta be something else (sticking .jar in wrong directory, etc.)

    Thats all i got im afraid...perhaps the other forum members have some better ideas?

    Ta

    Rich
  • richie's avatar
    richie
    Community Hero
    Hey joso1,

    I didnt even know you could connect to Azure SQL using JDBC.
    When i was hitting Azure SQL i used REST to run my queries. I thought AzureSQL runs in the cloud and so i never had direct queryable access to the underlying tables. Instead we queried the entity layer (XML) that sits above the tables (using fetchXML). I think the entity layer is a security feature so people cant interact with the tables themselves.

    Ta

    Rich
    • joso1's avatar
      joso1
      New Contributor

      Hey richie 

       

      It was a cake walk when I did with odbc/adal libs in python. I did some reading and research and jdbc connection is doable with authentication. I cant seem to get my head around this one here though!

      • richie's avatar
        richie
        Community Hero
        Hey joso1,

        I did a bit of googling and for some versions of the adal jar there were missing dependencies, so you might want to check this isnt a problem with your version of the .jar file.

        Stackoverflow link: https://stackoverflow.com/questions/52270540/not-able-to-get-azure-token-using-adal4j-api

        I know youre trying to connect using groovy, but when i try and setup new db connections using jdbc in ReadyAPI!, quite often if im having problems i'll try and setup the connection in a db interrogation tool first (removing some of the complication) like say DBVisualiser/TOAD etc. The JDBC config required in the db tools is identical to ReadyAPI! so doing it this way i at least know that the jdbc connection string parameters are correct (as they can change based on how the db is setup) which is most of the problem to be resolved. Once ive got my connection setup in the db tools i then know if i replicate the settings in ReadyAPI! and it doesnt work, the problem cant be incorrect driver .jar nor incorrect jdbc connection url and that it has gotta be something else (sticking .jar in wrong directory, etc.)

        Thats all i got im afraid...perhaps the other forum members have some better ideas?

        Ta

        Rich