How to change database connection settings in Orchard CMS.

by Virender
October 19, 2015

Change database connection string in Orchard CMS.

Orchard support MSSQL server in two ways

1. Use built-in data storage(SQL Server compact)
2 . Use an existing SQL Server(or SQL Express) database

If you want change database string of orchard CMS , you will not able to find anything in web.config file in main root !

The reason is that orchard CMS use “App_Data” folder for setup database connection settings .

You can find out database setting file “Settings.txt”  in “Orchard.WebApp_DataSitesDefault” folder.


You will see content of “Settings.txt” file like this

————————————————————-

State: Running
Themes:
Modules:
Name: Default
DataProvider: SqlServer
DataConnectionString: Data Source=server;Initial Catalog=database;Persist Security Info=True;User ID=sa;Password=system12345
DataTablePrefix: Code
RequestUrlHost: null
RequestUrlPrefix: null
EncryptionAlgorithm: AES
EncryptionKey: FB5FC52C3F550C7C54D5D7F14EB144A63E09333FD01D6FA0D0BE6A73A67E6B74
HashAlgorithm: HMACSHA256
HashKey: 95A56592B3D0543C7C5E1BD5D49C2A20366F52BA5F726138D5DE7BD1CA49D900003E4DBD272E0B53DD16524F62AD4C4BC0B0D19BB0BF84761B6FC08F93F98FA8

————————————————————-

You need to change these two settings

Orchard settings for SqlServer DataProvider

DataProvider: SqlServer
DataConnectionString: Data Source=server;Initial Catalog=database;Persist Security Info=True;User ID=sa;Password=system12345

Orchard settings for SqlCe DataProvider 

DataProvider: SqlCe
DataConnectionString: Data Source=server;Initial Catalog=database;Persist Security Info=True;User ID=sa;Password=system12345

If you want start from fresh database with other DataProvider delete “App_Data” and start again.

Note: You can face “SERVER ERROR IN ORCHARDLOCAL APPLICATION” problem when database connection settings is wrong.

For see log file go into “Orchard.WebApp_DataLogs” folder and you will able to see log file there.

Share:

Tags:

Related posts