For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Create the database tables with Ant tasks

The database tables for the MobileFirst Server applications can be created manually, with Ant Tasks, or with the Server Configuration Tool. The topics provide the explanation and details on how to create them with Ant tasks.

We can find relevant information in this section about the setting up of the database if MobileFirst Server is installed with Ant Tasks.

We can use Ant Tasks to set up the MobileFirst Server database tables. In some cases, we can also create a database and a user with these tasks. For an overview of the installation process with Ant Tasks, see Installing MobileFirst Server in command line mode.

A set of sample Ant files is provided with the installation to help you get started with the Ant tasks. We can find the files in mfp_install_dir/MobileFirstServer/configurations-samples. The files are named after the following patterns:

configure-<appserver>-<dbms>.xml
The Ant files can do these tasks:

  • Create the tables in a database if the database and database user exist. The requirements for the database are listed in Database requirements.
  • Deploy the WAR files of the MobileFirst Server components to the application server. These Ant files use the same database user to create the tables, and to install the run time database user for the applications at run time. The files also use the same database user for all theMobileFirst Server applications.
create-database-<dbms>.xml
The Ant files can create a database if needed on the supported database management system (DBMS), and then create the tables in the database. However, as the database is created with default settings, it is not meant to be used for production.

In the Ant files, we can find the predefined targets that use configureDatabase Ant task to set up the database. For more information, see Ant configuredatabase task reference.


Using the sample Ant files

The sample Ant files have predefined targets. Follow this procedure to use the files.

  1. Copy the Ant file according to our application server and database configuration in a working directory.
  2. Edit the file and enter the values for our configuration in the <! -- Start of Property Parameters --> section for the Ant file.
  3. Run the Ant file with the databases target: mfp_install_dir/shortcuts/ant -f your_ant_file databases.
This command creates the tables in the specified database and schema for all MobileFirst Server applications (MobileFirst Server administration service, MobileFirst Server live update service, MobileFirst Server push service, and MobileFirst Server runtime). A log for the operations is produced and stored in your disk.


Different users for the database tables creation and for run time

The sample Ant files in mfp_install_dir/MobileFirstServer/configurations-samples use the same database user for:

If we want to separate the users as described in Database users and privileges, you need to create your own Ant file, or modify the sample Ant files so that each database target has a different user. For more information, see Installation reference.

For DB2® and MySQL, it is possible to have different users for the database creation and for the run time. The privileges for each type of the users are listed in Database users and privileges. For Oracle, we cannot have a different user for database creation and for the run time. The Ant tasks consider that the tables are in the default schema of a user. If we want to reduce privileges for the runtime user, we must create the tables manually in the default schema of the user that will be used at run time. For more information, see Creating the Oracle database tables manually.

Depending on your choice of the supported database management system (DBMS), select one of the following topics to create the database with Ant tasks.

Parent topic: Relational databases