LocalDB deployment on client PC
Asked Answered
A

2

52

I am very intrigued by this new version of SQL Server Express.

It's not clear (to me) what a setup program should do to deploy an application that use a LocalDB.

Is it required to install SQL Server Express on the client PC and then attach the MDF file?

Or it's only required to run the LocalDB.msi and it works as a standalone file like SQL Server Compact?

Avenue answered 11/3, 2012 at 13:32 Comment(3)
Watching this presentation may help: channel9.msdn.com/posts/SQL11UPD03-REC-07Hairpin
Have you considered using SQL Server CE? No standalone process, but almost identical functionality. Not sure if it would be of use in your case - but if so, it makes deployment a breeze (there isn't any)Ujiji
Sorry, no support for stored procedure. I should explain. I see the LocalDB as a way to distribute a full functionally demo of my real application who requires a SQLServer with data-sharing. I wish to ship a CD or put a dowload on site without requiring the install of a SQLServer on the customer PCAvenue
K
40

You don't need to install SQL Server Express to use LocalDB, as LocalDB is SQL Server Express, just easier to install.

Once LocalDB is installed you can use AttachDbFileName property of the connection string to "open" an MDF file. Keep in mind that the same file can only be opened by a single LocalDB instance (single Windows login) at any given time, so this is not a data-sharing feature.

Update: If your application is using .NET Framework, make sure to install .NET Framework 4.0.2 or newer, as mentioned here. The original .NET Framework 4 doesn't understand LocalDB connection strings, as it shipped long before LocalDB.

Konrad answered 13/3, 2012 at 20:26 Comment(7)
So, my setup application just installs the LocalDB binaries then update my connection string and I am ready to go? Thanks for the clarification on the data-sharing question.Avenue
I updated the answer with the .NET 4.0.2 requirement. The details of other problems he mentioned are not clear yet, please see this thread for some background.Konrad
even I have .NET 4.5 but I still don't have LocalDBTransient
@JohnNguyen You still have to install LocalDB. It doesn't come with .NET microsoft.com/en-us/download/details.aspx?id=42299 It's LocalDB 64BIT\SqlLocalDB.msi or LocalDB 32BIT\SqlLocalDB.msi in the listTraherne
This really helped save my hide as I was just getting ready to completely redo my application with a Local sdf database which meant I would have had to use SQLServerCE... which would have taken hours as it's API is different and I had already coded everything with. I was thinking I should have used a local db from the gate but I didn't want to have to use the unfamiliar SQLServerCE API... So I stuck with a Service Based database but then had issues on deployment as I had a full version of SQL Server on the Deployment machine. I uninstalled SQL Server on that machine and installed LocalDB!Inhospitality
@Krzysztof how to install or use a licalDB ??is there a tutorial?Bred
@Traherne you should make your comment an answer. that's what made it work for me.Scissile
C
0

Note that you only have to install SQLLocalDB which is part of SQL Express software. You can directly download the SQLLocalDB file here - https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-ver16 and run it in client machine where you have your software.

Chauffeur answered 23/7, 2022 at 18:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.