20

Is there a way to specify the authentication method (SQL Server or Windows Authentication) when connecting to SQL Server with DataGrip?

I have tried configuring using both the SQL Server(jTDS) and the SQL Server(Microsoft) drivers and don't see an option on either.

2 Answers 2

36

With the jTDS Driver:

This is dependent on the settings for the connection/data source.

i.e. To set up a connection for Windows Authentication:

  1. In the "General" tab, if specify your Windows/AD Username in the User field.
  2. on the "Advanced" tab, in the DOMAIN property, specify the domain for the Windows account you put in Step 1.
  3. You may need to set USENTLMV2=true if Kerberos authentication isn't enabled on your network

If you don't specify the domain in step 2, it will assume you are doing a SQL Server Authentication login attempt.

With the Microsoft Driver:

I couldn't get this to work on OS X, but most people seem to have no issues on Windows.

  1. In the "Advanced" tab for the data source, set integratedSecurity to true.

n.b. you may have to also set this property for the actual Driver as well, on OS X i was getting continually "This driver is not configured for Integrated Authentication", but that could be OS X thing.

Hope this helps.

8
  • I had the same experience - works for jTDS driver, but not the Microsoft one.
    – Mark Meuer
    Feb 9, 2016 at 20:31
  • Unfortunately 2016.1.1 does not have a DOMAIN property in the Advanced tab. Tried adding one via User Defined property but no luck connecting from Mac
    – rams
    May 26, 2016 at 13:10
  • Hi @rams i just updated to 2016.1.1 and i'm still seeing a DOMAIN property for the jTDS driver. it's towards the bottom of the list.
    – pwae
    May 29, 2016 at 9:31
  • @pwae My mistake. I was using the wrong driver. With jTDS I do see the DOMAIN option. It's not available with the SQL Server driver.
    – rams
    May 30, 2016 at 17:06
  • 1
    I don't see how this has to do with OSX when it connects fine via other programs such as SQLPro for MSSQL. This is a DataGrip problem, not an OSX problem.
    – swade
    Jun 7, 2016 at 16:28
7

I was able to connect on MacOS in Intellij 2018.2 using the Microsoft 7.0.0 SQL Server jdbc driver.

(First, I'm assuming you have Kerberos working. To check that, run:

klist | grep krbtgt

If you have a Kerberos ticket, you should see:

Aug 29 12:17:34 2018  Aug 29 22:17:34 2018  krbtgt/[email protected]

I used this article on Connecting using ActiveDirectoryIntegrated Authentication Mode to troubleshoot this. Note that I did not have to do "Step 2: Configuring KDC in krb5.conf". )

Make sure to set the jdbc driver to use integrated security and Java Kerberos.

Picture of Advanced tab in Project Data Sources

Picture of Advanced tab in Project Data Sources showing authentication scheme

Then, on the general tab, make sure to change the drop down menu next to the URL, to "URL only" and put in a URL of the form:

jdbc:sqlserver://databaseserver.domain.company.com;database=testdatabase;integratedSecurity=true;authenticationScheme=JavaKerberos;encrypt=true;trustServerCertificate=true;

Picture of General tab in Project Data Sources

If you leave the drop down next to URL on "default", it will attempt to use a user name/password, which is not what you want if you're using integrated authentication. Also, please make sure you know what you're doing if you leave "trustServerCertificate=true;" in the URL. In production, you should properly setup your certificates, but that's not in the scope of what's being asked here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.