For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Create the DB2 database tables manually
Use the SQL scripts that are provided in the MobileFirst Server installation to create the DB2® database tables.
Before you begin
The DB2 database must fulfill the requirement as described in DB2 database and user requirements.
As described in Set up databases, all the four MobileFirst Server components need tables. They can be created in the same schema or in different schemas. However, some constraints apply depending on how the MobileFirst Server applications are deployed to the Java™ application server. They are the similar to the topic about the possible users for DB2 as described in Database users and privileges.
- Installation with the Server Configuration Tool
- The same schema is used for all components (MobileFirst Server administration service, MobileFirst Server live update service, MobileFirst Server push service, and MobileFirst runtime)
- Installation with Ant tasks
- The sample Ant files that are provided in the product distribution use the same schema for all components. However, it is possible to modify the Ant files to have different schemas:
- The same schema for the administration service and the live update service as they cannot be installed separately with Ant tasks.
- A different schema for the runtime
- A different schema for the push service.
- Manual installation
- It is possible to assign a different data source, and thus a different schema, to each of the MobileFirst Server components.
The scripts to create the tables are as follows:
- For the administration service, in mfp_install_dir/MobileFirstServer/databases/create-mfp-admin-db2.sql.
- For the live update service, in mfp_install_dir/MobileFirstServer/databases/create-configservice-db2.sql.
- For the runtime component, in mfp_install_dir/MobileFirstServer/databases/create-runtime-db2.sql.
- For the push service, in mfp_install_dir/PushService/databases/create-push-db2.sql.
The following procedure creates the tables for all the applications in the same schema (MFPSCM). It assumes that a database and a user are already created. For more information, see DB2 database and user requirements.
Procedure
Run DB2 with the following commands with the user (mfpuser):
db2 CONNECT TO MFPDATA db2 SET CURRENT SCHEMA = 'MFPSCM' db2 -vf mfp_install_dir/MobileFirstServer/databases/create-mfp-admin-db2.sql db2 -vf mfp_install_dir/MobileFirstServer/databases/create-configservice-db2.sql -t db2 -vf mfp_install_dir/MobileFirstServer/databases/create-runtime-db2.sql -t db2 -vf mfp_install_dir/PushService/databases/create-push-db2.sql -tIf the tables are created by mfpuser, this user has the privileges on the tables automatically and can use them at run time. If we want to restrict the privileges of the runtime user as described in Database users and privileges or a finer control of privileges, refer to the DB2 documentation.
Parent topic: Create the database tables manually