Working with Databases
WSO2 IoTS provides scripts for installing and configuring MySQL, H2, Oracle, MSSQL and PostgreSQL. Each of these databases supports stored procedures, which allow the business logic to be embedded inside the database as an API, providing a powerful mechanism to interact with a relational database. Because these procedures are stored in a pre-compiled format within the database itself, execution speed is very fast. Client programs can be restricted to access a database via stored procedures only, thereby enforcing fine-grained security, preservation of data integrity, and improved productivity.
The default database of the user manager is the H2 database that comes with WSO2 IoTS. You can configure it to point to databases by other vendors such as MySQL, Oracle, PostgreSQL, and Microsoft SQL Servers, using the scripts provided by WSO2 for installing and configuring relational databases. The scripts in the <PRODUCT_HOME>/dbscripts
 folder are available for all WSO2 products. They store data related to WSO2 Carbon, on top of which all WSO2 products are built.Â
The embedded H2 database is suitable for development. However, for most enterprise testing and production environments, we recommend an industry-standard RDBMS such as MySQL etc.
For more information on working with the databases check out the following subsections:
Setting up the physical database
The <IoTS_HOME>/dbscripts
 folder contains all the database script files related to configuring the respective databases:
Database | File path |
---|---|
API Manager | <IoTS_HOME>/dbscripts/apimgt |
Carbon Device Management Framework (CDMF) | <IoTS_HOME>/dbscripts/cdm |
Message Broker | <IoTS_HOME>/wso2/broker/dbscripts/mb-store |
Data Analytics Server | <IoTS_HOME>/dbscripts/metrics |
Folder structure
<IOTS_HOME>/dbscripts
 folder.The
<IOTS_HOME>/dbscripts/cdm
folder contains the database script files related to the Connected Device Management Framework (CDMF).The
<IOTS_HOME>/dbscripts/cdm/plugins
 folder contains the database scripts for platform specific plugins.ÂBy default, you only have scripts for the android and windows device types.
Example: Database scripts for the Android plugin are located in theÂ
<IOTS_HOME>/dbscripts/cdm/plugins/android
 directory.
What's next
For more information on setting up physical databases, see the following subsections: