New answers tagged


It is recommended to handle custom DB in different ways instead of using Sitecore APIs. However, need may arise to use dbs (other than default Sitecore Dbs) e.g. for having different publishing targets etc. In that case, after adding the DB in connection string, you also need to add database to your configurations as below - <?xml version="1.0" encoding=...


If you are using custom database, treat this as a normal ASP.Net MVC/core application and write the code accordingly. You can add your connection string inside the web.config and use normal C# code to connect the database. You can use SqlConnection class to connect database.


You should not use the Sitecore API to connect to non-Sitecore databases. They are not designed to do that. Use EF or any other way you prefer - anything that you would use in a project that has no Sitecore. The connectionstring can stay in the connectionstrings.config where you have it now.

Top 50 recent answers are included