Connection Strings Settings
Information on the connection strings settings section
The connection strings settings section contains the connection string to the database Umbraco will connect to. This section is similar to what is used by default in .NET Core. The important thing is that the key for the connection string Umbraco will use is "umbracoDbDSN". It is also important to know that this section is outside the Umbraco.CMS section, and is therefore in the root of the config.
The connection strings config can look like this:
{
"ConnectionStrings": {
"umbracoDbDSN": "Data Source=|DataDirectory|/Umbraco.sqlite.db;Foreign Keys=True;Pooling=True",
"umbracoDbDSN_ProviderName": "Microsoft.Data.Sqlite"
}
}The connection string shown here is an SQLite connection string that connects to the database file Umbraco.sqlite.db in the /umbraco/Data folder.
Umbraco currently supports using either a Microsoft SQL Server or a SQLite database. Both of these options will have different connection strings. For more information about the specific connection strings, see:
Database timeouts
Two separate timeouts apply to the database connection:
The command timeout is the maximum time a single database command can run before it is canceled.
The connect timeout is the maximum time to wait when opening a connection to the database.
You can set both in the connection string, or with the Database command timeout and Database connect timeout global settings.
The keywords used in the connection string depend on the database provider:
SQL Server
Command Timeout
Connect Timeout or Connection Timeout
SQLite
Default Timeout
Not supported
The following connection string gives commands five minutes to complete, while a connection attempt is abandoned after 30 seconds:
How the command timeout is resolved
Umbraco uses the first of the following that applies:
A timeout set in code for a single command.
A timeout set in code on the database instance, for example by a package.
The
Umbraco:CMS:Global:DatabaseCommandTimeoutsetting.The command timeout in the connection string.
The connect timeout in the connection string. This step is deprecated. See Deprecated: connect timeout used as the command timeout.
The database provider's default, which is 30 seconds for both SQL Server and SQLite.
The connect timeout is resolved the same way, without the deprecated step: the DatabaseConnectTimeout setting first, then the connection string, then the provider default.
Deprecated: connect timeout used as the command timeout
Where the connection string sets a connect timeout and no command timeout, Umbraco also uses the connect timeout as the command timeout. This behavior is deprecated. Where it applies, Umbraco logs a warning once at startup.
To prepare, do one of the following:
Add
Command Timeoutto the connection string.Configure the
Umbraco:CMS:Global:DatabaseCommandTimeoutsetting.
Provider name
Because Umbraco cannot determine the provider name from the connection string in all cases. Umbraco follows Microsoft's convention for provider names, which involves specifying it as a postfix in the connection string name.
Last updated
Was this helpful?