27

I set up a site in Orchard CMS. While choosing data storage settings I chose

Use an existing SQL Server(or SQL Express) database

Instead of

Use built-in data storage(SQL Server compact)

It has worked fine for me but I am wondering where to change the data source that is the database server name. I didn't find the connection string settings in web.config file.

Jan_V
  • 4,244
  • 1
  • 40
  • 64
waqari
  • 447
  • 1
  • 7
  • 13

4 Answers4

48

To change the database, you should edit the DataConnectionString entry in the App_Data\Sites\Default\settings.txt file.

It should look something like this:

Name: Default
DataProvider: SqlServer
DataConnectionString: Data Source=servername;Initial Catalog=dbname;User Id=username;Password=password;

You do need to restart the website after the change is made. If you can't reset the webserver yourself, edit in the web.config (add a space) or in the bin directory should suffice. .NET resets the website when something happens in this file or folder.

Jan_V
  • 4,244
  • 1
  • 40
  • 64
  • 1
    Apparently not everything in `settings.txt` is honored: https://github.com/OrchardCMS/Orchard/issues/4224 ("_The connection string is dynamically generated and therefore doesn't use the settings.txt information so the Max Database Size is defaulting to 256 and cannot be increased._") – Jean Jordaan Nov 08 '16 at 09:07
8
.\App_Data\Sites\Default\settings.txt

but you can't just change it to point to a empty database. the database needs to be prepared for orchard cms first.

j0k
  • 22,600
  • 28
  • 79
  • 90
SavySoda
  • 81
  • 1
  • 1
3

Take a look at .\App_Data\Sites\Default\settings.txt.

JonnyBoats
  • 5,177
  • 1
  • 36
  • 60
  • i modified Initial Catalog in dataconnectionstring but didn't work for me.After that i modified DataPrefix but it didn't work either – waqari Jan 25 '11 at 07:35
2

To change connection string in Orchard you should go to Orchard.Web,in that App_Data\Sites\Default\Settings.Txt

Suraj Bhatia
  • 97
  • 1
  • 4