Search code examples
sql-serverauthenticationoledb

SQL Server Windows user authentication


I have been given credentials to login to a SQL Server instance. I have tried several drivers/apps to login with no luck. For example using the Data Link / OLEDB way to test the connection. I get the following error:

Test connection failed because of an error in initializing provider. Login failed for user 'corporate\username'

The username is a Windows account based on its format. My question is exactly how do these Windows usernames behave when logging in.

The OLEDB setup dialog says you can use "Use Window NT integrated security" but if you do then you cannot specify the username/password. So, does that mean you must be logged in a 'corporate\username' on your machine to ever login to SQL Server?


Solution

  • After finally getting past this problem. Here's the solution I found.

    If you are running Windows and your machine in on the same Domain. I believe these comments about using "Run As.." and using "Integrated Security" should work. My machine was not on the corporate domain and so got "untrusted domain" errors. Also, this is a purely Windows solution which wasn't what I finally needed.

    If you want to connect from Linux, Mac or Windows machines, then use the jTDS JDBC driver. You don't have to be in the domain. And thus you don't even need to be using Windows. You just specify the domain, username, password in the connection string.

    Note that the standard Microsoft MSSQL JDBC driver will not authenticate against the domain. But this jTDS JDBC driver does.

    Also if you need a client program Squirrel SQL works fine with the driver.