Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Roberto Bianchi 137 posts 446 karma points c-trib
    Nov 28, 2016 @ 15:09
    Roberto Bianchi
    0

    Add password to .sdf database on new Umbraco installation

    Hello!

    How it's possible to add a custom password to an .sdf database when you create a new Umbraco installation?

    Because usually, when I select SQL CE Compact database on the installation, the wizard create a db with an empty password...

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Nov 28, 2016 @ 17:16
    Niels Hartvig
    1

    Hi Bob!

    As a DB password must be specified when creating the database for SQL Server compact, I'd think the only way to do that would be to create a new SQL Server Compact Database and then remember to add the password to the web.config connection string.

    For reference: https://technet.microsoft.com/en-us/library/ms171741(v=sql.110).aspx

    An alternative is to use SQL Server instead of Compact.

    Hope this helps, Niels...

  • Roberto Bianchi 137 posts 446 karma points c-trib
    Nov 29, 2016 @ 08:10
    Roberto Bianchi
    0

    Thank you Niels ;)

  • Roberto Bianchi 137 posts 446 karma points c-trib
    Nov 30, 2016 @ 10:51
    Roberto Bianchi
    101

    I found the solution!

    If you've already created the db and you want to add the password, there is a tool (for command line) called SqlCeCmd40.

    From cmd, after you have moved to the folder that contains the SqlCeCmd40.exe, you can run this command:

    sqlcecmd40 -d "Data Source=C:\path-of-umbraco-appdata\Umbraco.sdf;" -z "Data Source=;Password=secretpasswordtochoose"
    

    Now, to access the db you need to use the password.

    So, you've just to change the web.config with a new connectionstring:

    <add name="umbracoDbDSN" connectionString="Data Source=|DataDirectory|\Umbraco.sdf;Password=secretpasswordtochoose;Flush Interval=1;" providerName="System.Data.SqlServerCe.4.0" />
    

    I hope this little tutorial can be helpful to others :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies