SQL: Accessing SQL Server Express localdb from another computer

I saw a discussion on a forum the other day about whether or not you could access the localdb version of SQL Server Express from another computer. Lots of people were saying it's only a local tool and you can't access it from elsewhere.

But that's not true.

You actually can connect to a localdb instance from other machines. It's a perfectly valid configuration. (Although, if you're really running it like a service, you'd be better off with SQL Server Express Edition instead).

localdb is a deployment method for SQL Server Express edition, where instead of being started as a service, the database is started as a child process to another process (or application).

First, you need to make sure that the localdb instance is fired up. localdb is normally started by an application that it's attached to, like the way it can be used with Visual Studio to provide a local version of a SQL Server database, that's easier to deploy than SQL Server Express.

Now that can be your application, if you only need others to connect while your application is running. Alternately, it can be via the SqlLocalDB Utility. See here: https://docs.microsoft.com/en-us/sql/tools/sqllocaldb-utility

The SqlLocalDB utility can be the host process that launches localdb. It has options to start and stop it along with a few additional options.

Second, you need to make sure that TCP is enabled. Details of setting up a shared instance are described here: https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb

Hope that helps someone.

Leave a Reply

Your email address will not be published. Required fields are marked *