Database Settings

If you want to quick know the walkthrough for database setup, see.

Structure
On OpenSim 0.7.1 or later, you need to set StorageProvider and ConnectionString for each data services (e.g. region database, asset service, inventory service) in the config files in config-include/. Usually you'll need to edit StandaloneCommon.ini for standalone or GridCommon.ini for grid mode.

In those files, you'll find [DatabaseService] section, which parameters control the parameters of data services in general. Only you have to care about are these two lines below:

StorageProvider = "OpenSim.Data.MySQL.dll" ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;"

In this case, it will connect to the database which can access by the connection string "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;" using the provider module named "OpenSim.Data.MySQL.dll".

Or, you can include another ini files. You'll find a line like that: Include-Storage = "config-include/storage/SQLiteStandalone.ini"; It means it will go on to read config-include/storage/SQLiteStandalone.ini after reading this ini file. If you open SQLiteStandalone.ini file, you'll find StrageProvider and ConnectionString lines in each sections.

Possible Values for ConnectionString
(TODO: needs detail)

Example:
 * Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true; (For MySQL)
 * URI=file:db/OpenSim.db,version=3,UseUTF16Encoding=True (For SQLite)
 * Data Source=(local);Database=opensim;User=opensim;password=********; (For MSSQL)

Using Multiple Storages
Currently there are several services in OpenSim.
 * [InventoryService]
 * [AssetService]
 * [AvatarService]
 * [AuthenticationService]
 * [UserAccountService]
 * [GridUserService]
 * [FriendsService]
 * [EstateDataStore]
 * [SimulationDataStore]
 * [PresenceService]
 * [AuthorizationService]
 * [GridService]

You can use different storage for some service by overriding the same propaties in the section for those service. For example, if you are using OpenSim standalone and want to use MySQL 'opensim' in general but MySQL 'opensim2' for Inventory Service and MSSQL for Authentication Service, you'll need to write in StandaloneCommon.ini like that: [DatabaseService] StorageProvider = "OpenSim.Data.MySQL.dll" ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;" ... [InventoryService] ConnectionString = "Data Source=localhost;Database=opensim2;User ID=opensim;Password=***;Old Guids=true;" ... [AuthenticationService] ...(another parameters for authentication service)... StorageProvider = "OpenSim.Data.MSSQL.dll" ConnectionString = "Data Source=(local);Database=opensim;User=opensim;password=********;"

If OpenSim can't find StorageProvider or ConnectionString in each service's section, it will use those in [DatabaseService] section. If OpenSim find each or them, it will use the parameter in each service's section. Thus, then the settings in these sections override those in [DatabaseService] section.

In this case, Inventory Service will:
 * read [DatabaseService]StorageProvider
 * read [DatabaseService]ConnectionString -> read [InventoryService]ConnectionString and override

Ahthentication Service will:
 * read [DatabaseService]StorageProvider -> read [AuthenticationService]StorageProvider and override
 * raad [DatabaseService]ConnectionString -> read [AuthenticationService]ConnectionString and override

Note: SQLite and MSSQL providers don't support some services.

Note: For Estate Service, there is another parameter EstateConnectionString in [DatabaseService]. It is the middle priority between [DatabaseService] and [EstateDataStore] ConnectionStrings. OpenSim reads ConnectionString in [DatabaseService] section first, next EstateConnectionString, finally ConnectionString in [EstateDataService] section and overrides.

SQLite
Out-of-the-box.

MySQL
(TODO)

MSSQL
(TODO)