Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can SQL Server Express LocalDB be connected to remotely?

I am looking into using the new SQL Server Express LocalDB (I think it is code named "Denali") for a desktop application.

It is currently running with SQL Compact, but the user is wanting to share the database between multiple PCs on a network. Unfortunately this is not something that SQL Compact can do, so I am investigating other solutions.

The client requires the ability to send database files easily to other sites or to back them up to a flash disk, so I am avoiding going to SQL Express because there is quite a bit of "administrator" knowledge required to backup and restore.

So, my questions is, does the new SQL Express LocalDB support remote connections to the database over a network and/or through a shared network folder with the mdf file in it?

LocalDB does support supplying a path for an attached local DB in it's connect string (AttachDbFileName) hence the shared network folder option.

NOTE: This question pertains to "LocalDB" the new version of SQL Express 'Denali' and not to SQL Server Express 2008 or prior. See article here announcing LocalDB's release: http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx

like image 263
Mark Whitfeld Avatar asked Feb 08 '12 12:02

Mark Whitfeld


People also ask

Can you connect to SQL Express remotely?

Once you have SQL Express set up on your local computer, you can allow remote connections for members of your network.

What is the difference between LocalDB and SQL Express?

Despite their differences, Microsoft still allows both to be used for production applications at no cost. LocalDB can act as an embedded database for a small application and SQL Server Express can act as a more robust, full-featured remote database engine for larger applications.

What is SQL Express LocalDB?

Microsoft SQL Server Express LocalDB is a feature of SQL Server Express targeted to developers. It is available on SQL Server Express with Advanced Services. LocalDB installation copies a minimal set of files necessary to start the SQL Server Database Engine.


1 Answers

No, SQL Server Express LocalDB doesn't accept remote connections.

The idea with shared network folder might work, but only if you are able to make sure the LocalDB instance is shutdown before you try to copy the file. Also keep in mind that only one LocalDB instance can have any given database file open at the same time. and don't forget about the log files!

Additional security warning: unlike SQL Server Compact databases, SQL Server Express databases (including LocalDB ones) are not designed as secure data exchange format. For instance, they can contain malicious code in .NET assemblies embedded in them. So you should never open databases from untrusted source.

Maybe providing the customer with a simple tool that automates the backup process would be a better idea?

like image 138
Krzysztof Kozielczyk Avatar answered Sep 18 '22 14:09

Krzysztof Kozielczyk