This article is a mirror article of machine translation, please click here to jump to the original article.

View: 13574|Reply: 2

[Source] SQL Server connection string Application Name parameter is explained in detail

[Copy link]
Posted on 3/25/2020 6:14:14 PM | | | |
issue

When establishing a connection with SQL Server, by default, SQL Server does not know which software is establishing the connection.

If multiple applications are using a shared SQL Server and a connection is causing problems, the database administrator will be able to find the connection through a method called a SPID. However, it is more difficult to determine which app or website is responsible for the connection that caused the error.

However, if the developer includes the "Application Name" attribute in the connection string, then the database administrator will easily see the name of the application causing the problem. This will save DBA time and make developers popular in DBAs.

solution

Just add "Application Name = MyAppName; ”。 in the connection string. After that, you can also use the command "SELECT APP_NAME(); Use the value in SQL batch or SPREC.


C# connection string

When connecting to SQL Server, always include an optional Application Name parameter in the connection string. This way, SQL Server will get information about which application is using the connection. This can be very valuable information when looking for errors in a database server.

Reference links:

The hyperlink login is visible.





Previous:C# determines whether an executable is present in the Windows environment variable
Next:sqlcmd output incomplete solution
Posted on 4/28/2023 2:55:09 PM |
ApplicationIntent

ReadOnly: The application workload type when connected to the server is read-only.
ReadWrite: The application workload type when connected to the server is read/write.

https://learn.microsoft.com/zh-C ... t.applicationintent

The test will connect the string configurationApplicationIntent=ReadOnly ReadOnly, or it canExecute the successful insert and update statements

If you set the database connection string to ApplicationIntent=ReadOnly, the connection will be considered read-only, i.e., no write operations can be performed on that connection. However, this does not mean that writes cannot be performed. Normally, the database server ignores writes that are attempted on read-only connections, but this is not always the case.

In some cases, such as when using some older versions of drivers or client libraries, the application may bypass the read-only markup and successfully perform a write operation. There are other factors that can cause this behavior, such as having a weak isolation level enabled on the database, etc. If you want to ensure that only read operations are performed, make sure that the necessary security measures are implemented through other methods.

 Landlord| Posted on 12/23/2023 4:08:38 PM |
SQL SERVER database connection string configuration:https://learn.microsoft.com/en-u ... on.connectionstring
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com