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!
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
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.
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.
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:
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|
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.
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.
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:
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).
By the SQL Server Management Studio run those SQL script files against your serverside database.
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.
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!
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
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 :(
There is should be "umbracoDbDSN" connection. Umbraco uses "umbracoDbDSN" connection string.
/Alex
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
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
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
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
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
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:
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
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.
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...
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.
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...
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...
I was happy :)
But some error in that converting it. Trying for any other tool
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:
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).
By the SQL Server Management Studio run those SQL script files against your serverside database.
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/
You're right!
Let me try all these :)
Much thanks!
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
Thank you Alex.
I could retrieve the script from CompactView!
But the scripts are going error trying to fix.
Regards, Kowshik
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
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
is working on a reply...