Authenticating to a SQL Server instance as a Windows User via JDBC

后端 未结 9 1545
太阳男子
太阳男子 2020-12-06 06:37

I\'m having to support multiple database types for my tenant-enabled web application. Among others, I have successfully supported Microsoft\'s SQL Server, by using the net.s

9条回答
  •  长情又很酷
    2020-12-06 07:34

    Alternative Method

    The alternative solution is to utilize integrated security. This enables your application to connect to the database as the user in which the application is currently running as. This is enabled by adding integratedSecurity=true; into the connection string properties. If you run into any trouble, make sure the sqljdbc_auth.dll is accessible via classpath or within your app library.

    Security Note

    You're probably already aware, but just have to say make sure not to grant access to "Authenticated Users" to your database as previously suggested as part of the demonstration. Identify which user account your application runs as and grant access to only that specific user in your database server.

    Sources / Additional Info

    • MSDN Doc on JDBC Connection String Configuration (http://technet.microsoft.com/en-us/library/ms378428(v=sql.110).aspx)

提交回复
热议问题