none
SQL Server Express LocalDB RRS feed

  • Question

  • Can SQL Server Express LocalDB be installed without installing the full SQL Server Express ? For example, if I'm developing a small windows application using EF 6 with an .mdf file, and I want to install the application on another machine, will CreateDatabaseIfNotExist in EF create the .mdf on the machine the application is being installed on?

    Thursday, September 12, 2019 10:49 PM

Answers

All replies

  • Hello,

    Microsoft Server Express must be installed as it's a feature of SQL-Server Express. See the following page for details on installing LocalDB. So with that Entity Framework or Entity Framework Core per-say needs this else a runtime exception will be thrown

    https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-2017


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, September 12, 2019 11:16 PM
  • There is a MSI file that will install LocalDB standalone without needing the SQL Server Express installation done. You can also use the SQL Server Express installation file and only install LocalDB without installing SQL Server Express fully.

    The more recent version of VS install LocalDB too, since Visual Stuido Service Base database is a standalone MDF file using LocalDB.

    I am not a fan of any ORM acting like DBA tool.



    • Edited by DA924x Friday, September 13, 2019 12:51 AM
    Friday, September 13, 2019 12:48 AM
  • Karen,

    Thank you for your reply. From what i can tell, the issues I'm having are related to the automatic instance MSSqlLocalDB. I have a laptop that I only installed SQLLocalDB.msi for 2016. When i run my application, it fails to create the .MDF file. However, if I create a new instance:

    REM Create an instance of LocalDB "C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe" create LocalDBApp1 REM Start the instance of LocalDB "C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe" start LocalDBApp1

    and adjust my connectionstring to reference (localdb)\LocalDBApp1 instead of (localdb)\MSSqLLocalDB

    it creates the .mdf file and everything appears to work without issue?

    if i try and get info on MSSQLLocalDB using

    SqlLocalDB.exe info MSSQLLocalDB,

    i get an error stating to check the windows event log

    Could there be an issue with the connectionstring for MSSQLLocalDB ?

    Thanks,

    George



    • Edited by George.Yoder Friday, September 13, 2019 12:27 PM
    Friday, September 13, 2019 12:25 PM
  • Please refer to the following two links

    https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/introduction/creating-a-connection-string

    https://stackoverflow.com/questions/10540438/what-is-the-connection-string-for-localdb-for-version-11


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Friday, September 13, 2019 1:32 PM
  • IMHO, LocalDB is designed for software development with the detached MDF file being eventually attached to the Express or Server version of the MS SQL Server DB engine. Maybe, you should consider looking into using SQLite,.
    Friday, September 13, 2019 4:37 PM
  • Hi George.Yoder,

    Thank you for posting here.

    Since this thread is not related to c#, I will move it to Where is the Forum For…? forum to get professional support.

    The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 17, 2019 7:49 AM
  • I'd try asking for help over here.

    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlsetupandupgrade

     

     



    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    Tuesday, September 17, 2019 12:31 PM
    Moderator