LocalDB

LocalDB is a simplified version of SQL Server that doesn’t include networking. The features of Local DB include:

  • Has a smaller installation than SQL Express (approximately 30 MB)

  • is targeted to developers and non-network single user applications

  • Is easy to install and deploy

  • Requires no management

  • Provides an alternative to DataFlex files

  • Is fully compatible with other SQL Server editions

LocalDB allows developers to specify a database file location. This means that developers can distribute a database as standard files by detaching the database from LocalDB or Express server, copying the database files to another computer, and then attaching to them using that computer’s LocalDB installation. This simplifies installations and allows for demo workspaces that use Mertech’s drivers to be distributed without a lot of groundwork to get them up and running.

Installing LocalDB

LocalDB is free to install and requires no licensing. Local DB is available (along with the Express edition installers) here.

When you run the LocalDB installer a local instance is setup with the name “(localdb)MSSQLLocalDB″ (older versions used an instance name of “v11.0”). One of the differences from the express edition (and in fact a primary feature of LocalDB) is that the instance does not actually start a process or service on your PC. So, there are no resources used by a LocalDB instance while it is sitting idle. Once you connect to the instance and attach or create a database a process is started that lives until a few minutes after the last connection to it is closed.

Creating a Database

  1. Start a Windows Command Prompt.

  2. Launch the sqlcmd utility and enter an SQL statement to connect to the LocalDB server (default (localdb)\MSSQLLocalDB). A trusted connection is used in the example below.

  3. Enter an SQL statement to create a database (bar in the example below).

  4. Execute the SQL statements (go).

  5. Exit sqlcmd.

Localdb1.png

The database is created in the directory where the Command Prompt comes up, your user profile folder.

Note

LocalDB also includes a command line tool, SqlLocalDB.exe, that enables users to create, delete, stop, and start a LocalDB instance.

Note

A example using a LocalDB ships with Flex2Crystal. The example database, MTSample, is installed in the Documents Library: Flex2Crystal > Example Application > Data.