Copied to clipboard

Flag this post as spam?

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


  • kowshik 20 posts 90 karma points
    Apr 27, 2017 @ 14:52
    kowshik
    0

    changing the connection string to sql db did not restore the developed site

    We started development in default connection string and half of the project is completed. When I change the connection string to database the site is going back to default umbraco website. Please help me to recover the developed site? The old cofing file still works perfectly without the database.

    I tried to restore the database from from IIS web server in MSSQL but did not work!

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Apr 28, 2017 @ 12:20
    Alex Skrypnyk
    0

    Hi Kowshik

    Why did you change the connection string to the database?

    All data are stored in the database that was pointed in default connection string.

    You have to restore the first database or make all changes in the database again.

    Thanks,

    Alex

  • kowshik 20 posts 90 karma points
    Apr 28, 2017 @ 15:46
    kowshik
    0

    The default config file goes like this.

    data source=.\sqlexpress;integrated security=sspi;AttacheDBFilename=DataDirectory|apnetdb.mdf;User Instance=true

    To maintain the right connection string

    We changed the connection string to this format server=180.122.X.X;database=abc; userid=abc;password=XXXXX

    The site is up, but it is pointing to default :(

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Apr 28, 2017 @ 17:03
    Alex Skrypnyk
    0

    There is should be "umbracoDbDSN" connection. Umbraco uses "umbracoDbDSN" connection string.

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

    /Alex

  • kowshik 20 posts 90 karma points
    May 02, 2017 @ 08:51
    kowshik
    0

    Yes, that's right.

    But I want to use something like this. Wanted to add my own separate database. We already have similar other websites, which was NOT built by me and I have no idea about it. They used the below connection string enter image description here

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    May 03, 2017 @ 15:22
    Alex Skrypnyk
    0

    Hi Kowshik

    It's absolutely right situation - and MSSQL database is preferred database over SQL CE.

    The problem is when you changed database after working on the website - you loose your data. You have to migrate your data if your database is not empty and you want to change it.

    Thanks,

    Alex

  • kowshik 20 posts 90 karma points
    May 03, 2017 @ 15:32
    kowshik
    0

    Hi Alex,

    Thanks for your reply.

    From where do we restore date is my question.

    The previous database information is not available in connection string.

    Regards, Kowshik

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    May 03, 2017 @ 15:45
    Alex Skrypnyk
    0

    Hi Kowshik

    And this is right functionality.

    When you are working with connection #1 - everything is storing to the connection #1

    When you change connection to #2 - you lost everything and you have empty database

    You have to migrate database from connection #1 to connection #2

    Thanks,

    Alex

  • kowshik 20 posts 90 karma points
    May 04, 2017 @ 08:38
    kowshik
    0

    Hi Alex,

    Great favour that you are trying to help me.

    1.

    I'm not sure, where it is pointing to the connection string is below for first initial setup

    Also I tried to restore from the database thinking that it might have stored in same webserver There is no SSMS but I found some database here... From C:\programfile\Microsoft SQL server\MSSQL.

    Secondly, during setup it was asked for the SQL DB information and DB was build. Even though connecting to this DB did not work.

    2.

    So restore from this two location to new SQL is not working.

    Regards, Kowshik

  • Alexander Bryukhov 19 posts 68 karma points c-trib
    May 04, 2017 @ 11:25
    Alexander Bryukhov
    0

    Hello,

    if I can understand the situation correctly, the current question is "where to locate the database file form your first connection string"?

    If yes, then:

    1. Please note, if you have changed your string several times forth and back during your tests, and may lost couple of important things, then please be more accurate with them:

      data source=.\sqlexpress;integrated security=sspi;AttacheDBFilename=DataDirectory|apnetdb.mdf;User Instance=true

      • AttacheDBFilename should be AttachDBFilename
      • substitution symbol 'DataDirectory' should be wrapped in pipe sysbols "|" - |DataDirectory|
    2. AFAIK the default 'DataDirectory' value is the App_Data directory of the web application, so you can find the 'apnetdb.mdf' database file in the App_Data subfolder of your umbraco installation folder.

    3. After you will locate the database file with your data you can use e.g. backup-restore tool from your SQL Server ManagementStudio to back up the existing data and restore them to the full-featured SQL database.

    Hope it will help...

  • kowshik 20 posts 90 karma points
    May 04, 2017 @ 13:40
    kowshik
    0

    Thank you Alex!

    I found LDF and MDF from default location in webserver and I attached it in new SQL server. Site keeps loading with NO modification displays.

    And in App_Data folder, I can see "Umbraco-SQL server compact Edition Database file". Do I need to add this to SQL DB server?

    No other DB related file in App_Data.

  • kowshik 20 posts 90 karma points
    May 04, 2017 @ 14:34
    kowshik
    0

    Alex,

    I'm 90% sure that I need to restore, the file from "Umbraco-SQL server compact Edition Database file" which is in app_data folder in application.

    So, I need to convert sdf to SQL data file. May be to MDF format

    Trying to find it... Let me know if you have any idea...

  • Alexander Bryukhov 19 posts 68 karma points c-trib
    May 04, 2017 @ 14:48
    Alexander Bryukhov
    0

    Have found this detailed article with screenshots

    https://forum.sambapos.com/t/how-to-migrate-from-sql-compact-edition-sdf-file-to-sql-server-2012-express/752

    maybe it's exactly what you need, except database file and folder names in this example :-)

    P.S. Export utility attached to that post in zipped file...

  • kowshik 20 posts 90 karma points
    May 04, 2017 @ 15:18
    kowshik
    0

    I was happy :)

    But some error in that converting it. Trying for any other tool

  • Alexander Bryukhov 19 posts 68 karma points c-trib
    May 04, 2017 @ 15:27
    Alexander Bryukhov
    0

    I guess there are several different tools at the moment, by the way the SQL CE version on your machine matters too...

    In all similar solutions as far as I can understand there are two steps:

    1. Using some tool make the "scripting" backup file (just a bunch of SQL statements in text file, which creates all the tables etc. and inserts all the data).

    2. By the SQL Server Management Studio run those SQL script files against your serverside database.

  • Alexander Bryukhov 19 posts 68 karma points c-trib
    May 04, 2017 @ 15:08
    Alexander Bryukhov
    0

    Or different way with Visual Studio and special plugin for SQL CE export-import operations... Details are here:

    http://endzonesoftware.com/import-sql-server-compact-edition-files-sdf-sql-server/

  • kowshik 20 posts 90 karma points
    May 04, 2017 @ 15:46
    kowshik
    0

    You're right!

    Let me try all these :)

    Much thanks!

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    May 05, 2017 @ 10:57
    Alex Skrypnyk
    0

    Hi Kowshik

    Another option is to use Umbraco package "Export SQL Server Compact" - https://our.umbraco.org/projects/backoffice-extensions/export-sql-server-compact

    Please share how did you solve the issue.

    Thanks,

    Alex

  • kowshik 20 posts 90 karma points
    May 05, 2017 @ 12:22
    kowshik
    0

    Thank you Alex.

    I could retrieve the script from CompactView!

    But the scripts are going error trying to fix.

    Regards, Kowshik

  • kowshik 20 posts 90 karma points
    May 05, 2017 @ 15:39
    kowshik
    0

    Alex the conclusion is:

    Half of the DB part, ie mdf and ldf file are getting stored in webserver in program file and sql folder location that we could restore in sql DB server.

    Second half of the DB part, ie Tables (in sdf format), are getting stored in App_Data folder.

    When we try to open the table by 3rd party tool, we can see N number of tables created. In-order to re-store the table, we need to run in sequence that will go error if we do not arrange in sequence and that would be time consuming which is equal to building a new project again.

    I'm not finding any other way.

    Thanks a lot for your help.

    Regards, Kowshik

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    May 05, 2017 @ 15:46
    Alex Skrypnyk
    0

    You are welcome, Kowshik, it's really bad situation with data but I think you will not do it in future after this project ))

    Have a nice weekend!

    /Alex

Please Sign in or register to post replies

Write your reply to:

Draft