Can I connect to SQL Server using Windows Authentication from Java EE webapp?

Posted by KG on Stack Overflow See other posts from Stack Overflow or by KG
Published on 2008-10-03T15:36:21Z Indexed on 2010/05/20 12:20 UTC
Read the original article Hit count: 344

Filed under:
|
|
|
|

I am currently investigating how to make a connection to a SQL Server database from my Java EE web application using Windows Authentication instead of SQL Server authentication. I am running this app off of Tomcat 6.0, and am utilizing the Microsoft JDBC driver. My connection properties file looks as follows:

dbDriver              = com.microsoft.sqlserver.jdbc.SQLServerDriver
dbUser                = user
dbPass                = password
dbServer              = localhost:1433;databaseName=testDb
dbUrl                 = jdbc:sqlserver://localhost:1433

I have zero problems with connecting to a SQL Server database in this fashion when using SQL Server authentication.

Is there any way I can retrieve the credentials of the user's Windows Authentication and use that authentication for SQL Server?

UPDATE: I know in ASP.net there is a way to set up Windows Authentication for access to the webapp, which is exactly what I am looking for, except I want to pass that token off to SQL Server for access to the database.

© Stack Overflow or respective owner

Related posts about java

Related posts about java-ee