Skip to content
"Connecting SQL Server LocalDB on Windows 11 ARM with .NET"

How to connect to SQL Server LocalDB on Windows 11 ARM with .NET

If you’re like me and running Windows 11 ARM on a Snapdragon processor with SSMS 20.2, Visual Studio 17.11.2, and .NET 8, you might have experienced difficulties connecting from a .NET application to the LocalDB database using traditional connection strings. Some users have also reported issues connecting from SSMS to LocalDB on ARM, which is likely related to versioning compatibility.

Here is how I got it working with LocalDB:

Step-by-Step Guide to Connecting LocalDB on ARM

  1. Install LocalDB

Start by installing LocalDB via installation media. You can download SQL Express and then get the installation media for LocalDB. 

2. Install SQL Server Management Studio (SSMS)

Next, install SSMS. With SSMS installed, you should be able to connect to LocalDB with the following server name:
(LocalDB)\MSSQLLocalDB.

At this stage, SSMS should work with LocalDB. However, if you’re trying to connect from a .NET application, you’ll likely still encounter issues with traditional connection strings.

Connecting to LocalDB from .NET Applications

The key is to use a named pipe instead of the standard connection string.

  1. Open a command prompt and run this command:
SqlLocalDB.exe info MSSQLLocalDBCode language: CSS (css)

2. Look for the last entry in the result, which will be the named pipe. It will look something like this:

np:\\.\pipe\LOCALDB#C3E89C14\tsql\queryCode language: CSS (css)

3. Use this named pipe in your .NET application’s connection string:

"Data Source=np:\\\\.\\pipe\\LOCALDB#C3E89C14\\tsql\\query;Initial Catalog=YourDatabase;Integrated Security=True;"Code language: JSON / JSON with Comments (json)

4. You can also use this named pipe to connect through SSMS if needed.

5. As a caveat, you may have issues keeping your SQL LocalDB running because it doesn’t run as a service. If you get a blank named pipes string from the above command, this means that the instance isn’t running. You can run the command:

SqlLocalDB.exe startCode language: CSS (css)

The downside here is that each time you start it the named pipes string changes. It may be possible to keep it running longer. Check out this item for something that might help: https://stackoverflow.com/questions/14153509/how-to-prevent-sql-server-localdb-auto-shutdown.

Known Limitations on ARM

While this setup allows you to use LocalDB on Windows 11 ARM, there are some limitations. LocalDB lacks several advanced features, such as full-text search and support for large databases, which are available in full SQL Server.

Final Thoughts

This solution provides a workaround for using LocalDB on ARM devices with .NET applications. However, Microsoft may eventually release a version of SQL Server that runs natively on Windows ARM, which will improve compatibility.

If you’re encountering any issues or need further information, refer to the following documentation: