Reputation: 807
Do we need to start the default localdb instance manually everytime. How do i start a localdb server automatically.
do we need to start the server every time before connecting from a application ?
Upvotes: 1
Views: 1161
Reputation: 745
The localDB instance should start up when you first try to access the database. After a few minutes of inactivity, the instance will close and only start again when you try to access the database.
There should be no need to "manually" start localDB, although I have noticed sometimes that the application does not automatically start, though this is intermittent and I can find no explanation for it.
EDIT
In order to try to start LocalDB when the application first loads, put this in your Program.cs file, in the Main() function:
Process.Start("sqllocaldb.exe", "start v11.0");
This will attempt to spin-up the localDB exe on application startup.
Upvotes: 1
Reputation: 1597
You have a tags visual-studio and sql, so I guess it's MSSQL Server.
Go to your services (Control panel - Administrative tools) and find item with name "MSSQLSERVER". Under "Startup type" make sure it's "Automatic"
Upvotes: 0