SQL database developer tip: quickly test your ADO.NET connection strings without any tools or code
Posted: (EET/GMT+2)
Sometimes, you need to diagnose SQL database connection issues you're having in your .NET applications using either Entity Framework and/or ADO.NET within the customer site. When this happens, you usually don't have the convenience of your developer tools: Visual Studio's Server Explorer, or SQL Server Management Studio (SSMS).
But, here's a nice little trick: use so-called UDL files, an old Windows feature. These are officially called Universal Data Link (UDL) files.
Here are quick instructions:
- Create an empty file, such as “test.udl” in any folder, such as the computer desktop. You can first create a new text file, and the change the file extension.
- Open the file by double-clicking it.
- A familiar connection string editor opens. Now enter the required details.
- Test the connection to see if it works. Once you are done, save the settings by clicking OK.
- Open the file with a text editor, such as Notepad, and take note of the generated connection string.
Good luck in solving your database connectivity issues!