Question - What are the different authentication techniques used to connect with MS SQL Server?
Answer -
Before performing any task in the database, SQL Server will authenticate. Two types of authentication techniques are:
- Windows Authentication: This default authentication is provided only through Windows domain accounts. This SQL Server security model is strongly integrated with Windows, so it is also referred to as integrated security. Particular Windows users and group accounts are allowed to login into SQL Server. Windows users who are already been authenticated or logged onto Windows do not have to provide additional credentials.
The below-given SqlConnection.ConnectionString specifies Windows authentication without any need of providing a user name or password by the user.
C#
"Server=MSSQL1;Database=Institute;Integrated Security=true;
- SQL Server and Windows Authentication Mode(Mixed-mode): Authentication will be provided with the help of the Windows and SQL Server Authentication combination. User name and password pair will be maintained within SQL Server. In order to use this mixed-mode authentication, you need to create SQL Server logins that are stored in SQL Server. After that, you can supply the user name and password to SQL Server at run time.
The below-given ConnectionString specifies Mixed mode authentication:
C#
"Persist Security Info=False;User ID=Harsh;Password=xyz@123;Initial Catalog=Institute;Server=MySqlServer"