The Zurich release has arrived! Interested in new features and functionalities? Click here for more

JDBC data source only works with "Use integrated authentication"

MarkD
Tera Expert

 

When I attempt to run a JDBC / SQL Server data source, it fails with the following error:

MID Server reported error: java.sql.SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'username1'. 

 

The username and password are correct and I've confirmed them.

If I open the data source and select "Use integrated authentication", then also run the MID Server "as" the 'username1' account, the connection succeeds and the import works however I don't want to dedicate this mid server to just this data source.  I don't want to have to run the MID Server as username1.

 

My question is why would this work with integrated authentication, but not when I add the correct credentials to the data source directly? 

Is it something to do with how the SQL server was configured?

 

Any pointers would be appreciated.

4 REPLIES 4

John Czaplicki
Tera Contributor

I am having the same challenge, and it appears that JDBC credentials do not work with integration windows authentication.....at least to SQL server.  I am opening a case with ServiceNow because this seems a bit surprising, but from what i've read and what all my testing is concluding is that it does not work.  It works with SQL credentials just fine.

In my case, I'm attempting to use a widows autheticated DB connection for an SCCM datasource and the 'use integrated authentication' checkbox forces use of the MID server account.  It does not allow for a JDBC credential at all.  Another closely related issue.

If there's some rock I haven't looked under please respond, but at this point i'm pretty confident that it is not supported/working today.

Nicholas Eblen
Tera Contributor

This is a known problem - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0719341

The SQL Server database rejects the login attempt even if the username and password are correct because it requires Windows Integrated Authentication. This means that the credentials of the Windows user which the ServiceNow MID server Windows Service runs as needs to be used to access the SQL Server Database. 

 

Have you tried to create a user that uses SQL Server authentication?

John Czaplicki
Tera Contributor

Thank you for your reply.  Yes, this works.....it's just not what I want 🙂

What I mean is......  When I run Discovery I don't use the MID server account credentials to login into Linux servers and perform discovery.  I have a specific service account setup in the credential store (credentials stored externally in CyberArk for password rotation, etc).  Different domains, different accounts, etc.  

Basically, none of the benefits of using Credentials is possible, which is disappointing.

John, have you seen this community article. I'm also struggling with this because the authentication doesn't recognize the primary authentication for Azure database which is an "Azure credential" not the windows credential. In my organization, we would never use the SQL basic auth so using the Azure cred or a CyberArk cred in the store would be the most appropriate. The link below appears to be a hack to make the Azure cred work but I haven't tested it yet because I have MFA on all my Azure accounts and have to work through that but it might be a reasonable use case for you. 

 

https://www.servicenow.com/community/developer-articles/jdbc-connection-with-azure-sql-database/ta-p...