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

Create the DB2 database tables with Ant tasks

Use Ant tasks that are provided with MobileFirst Server installation to create the DB2® database.

To create the database tables in a database that already exists, see Create the database tables with Ant tasks.

To create a database and the database tables, we can do so by Ant tasks. The Ant tasks create a database in the default instance of DB2 if we use an Ant file that contains the dba element. This element can be found in the sample Ant files named as create-database-<dbms>.xml.

Before running the Ant tasks, make sure that you have an SSH server on the computer that runs the DB2 database. The configureDatabase Ant task opens an SSH session to the DB2 host to create the database. The SSH server is needed even if the DB2 database runs on the same computer where you run the Ant tasks (except on Linux and some versions of UNIX systems).

Follow the general guidelines as described in Create the database tables with Ant tasks to edit the copy of the create-database-db2.xml file.

You must also provide the login ID and password of a DB2 user with administration privileges (SYSADM or SYSCTRL permissions) in the dba element. In the sample Ant file for DB2 (create-database-db2.xml), the properties to set are: database.db2.admin.username and database.db2.admin.password.

When the databases Ant target is called, the configureDatabase Ant task creates a database with default settings with the following SQL statement:

CREATE DATABASE MFPDATA COLLATE USING SYSTEM PAGESIZE 32768 It is not meant to be used for production as in a default DB2 installation, many privileges are granted to PUBLIC.

Parent topic: Create the database tables with Ant tasks