Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Connect DB Tool to Azure Database

reactancexl
reactancexl Posts: 193

I have to use a bearer token with Micorosoft Entra Integrated to connect to database. Other than the mssql driver(com.microsoft.sqlserver.jdbc.SQLServerDriver) is there anything else special I need to add. What would the connection string be? I am using the following for url: jdbc:sqlserver://sql-group-qa-01-cus-tst.database.windows.net:1433;database=sqldb-group-qa-01-cus-tst;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;accessToken=${token} and are getting null pointer error

Tagged:

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,349 ✭✭✭
    edited June 16

    Other than the mssql driver(com.microsoft.sqlserver.jdbc.SQLServerDriver) is there anything else special I need to add.

    The Microsoft JDBC Driver for SQL Server has a lot of dependencies. There are a couple ways to get them as documented by Microsoft:
    https://github.com/microsoft/mssql-jdbc/wiki/Downloading-Driver-Dependencies
    https://github.com/microsoft/mssql-jdbc/wiki/Building-a-Driver-JAR-with-Dependencies

    and are getting null pointer error

    It is hard to say what might be calling a NullPointerException without the stack trace. Do you see a stack trace in the error detail if you double-click the test failure? Can you provide that here?

  • reactancexl
    reactancexl Posts: 193

    Error Message: java.lang.NullPointerException Additional Details: java.lang.NullPointerException at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011) at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006) at java.base/java.util.Properties.put(Properties.java:1346) at java.base/java.util.Properties.setProperty(Properties.java:230) at com.parasoft.db.JdbcConnectionFactory.getJDBCConnection(JdbcConnectionFactory.java:40) at com.parasoft.db.AppJdbcConnectionFactory.getJDBCConnection(AppJdbcConnectionFactory.java:25) at com.parasoft.db.VariableDbConnectionProvider.getConnection(VariableDbConnectionProvider.java:41) at webtool.db.DbTool.doApply(DbTool.java:202) at webtool.tool.WebTool.applyTool(WebTool.java:189) at com.parasoft.tool.Tool.apply(Tool.java:346) at com.parasoft.tool.Tool.getApplyResult(Tool.java:358) at webtool.test.ToolTest.run(ToolTest.java:903) at webtool.test.Test$4.loop(Test.java:1021) at webtool.test.execution.CompositeExecutionLoop.loop(CompositeExecutionLoop.java:60) at webtool.test.execution.CompositeExecutionLoop.loop(CompositeExecutionLoop.java:69) at webtool.test.execution.CompositeExecutionLoop.loop(CompositeExecutionLoop.java:69) at webtool.test.Test.run(Test.java:1183) at webtool.test.TestExecutor.run(TestExecutor.java:241) at com.parasoft.ptest.testcases.web.WebTestExecution.doRun(WebTestExecution.java:75) at com.parasoft.ptest.testcases.web.AbstractWebTestRunnable.runSingleTest(AbstractWebTestRunnable.java:308) at com.parasoft.ptest.testcases.web.AbstractWebTestRunnable.run(AbstractWebTestRunnable.java:177) at com.parasoft.ptest.execution.api.web.WebExecutionRunnable.launch(WebExecutionRunnable.java:594) at com.parasoft.ptest.execution.api.runnable.AbstractExecutionRunnable.launch(AbstractExecutionRunnable.java:424) at com.parasoft.ptest.execution.api.runnable.AbstractExecutionRunnable.runExecution(AbstractExecutionRunnable.java:284) at com.parasoft.ptest.execution.api.runnable.AbstractExecutionRunnable.run0(AbstractExecutionRunnable.java:174) at com.parasoft.ptest.checkers.api.run.AbstractRunnable.run(AbstractRunnable.java:213) at com.parasoft.ptest.checkers.api.run.CategoryRunnable.run(CategoryRunnable.java:254) at com.parasoft.ptest.checkers.api.run.ConfigRunner.runCheckerCategories(ConfigRunner.java:397) at com.parasoft.ptest.checkers.api.run.ConfigRunner.runConfig(ConfigRunner.java:229) at com.parasoft.ptest.checkers.api.run.ConfigRunner.runConfig(ConfigRunner.java:301) at com.parasoft.ptest.checkers.eclipse.ui.CheckerUIUtil$ConfigRunnableJob.run(CheckerUIUtil.java:421) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

  • benken_parasoft
    benken_parasoft Posts: 1,349 ✭✭✭

    From the 2024.2 release notes:

    SOA-18028 * DB Tool throws NullPointerException if username or password is empty

    This issue was introduced in 2024.2.0 then promptly fixed in 2024.2.1.

  • reactancexl
    reactancexl Posts: 193

    I updated to 2024.2.2 and it worked
    Here is the connection string without anything in the user and password fields for DB Tool.

    JDBC connection string
    jdbc:sqlserver://.database.windows.net:;database=;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;Authentication=ActiveDirectoryIntegrated

Tagged