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


Create the Oracle database tables with Ant tasks

Use Ant tasks that are provided with MobileFirst Server installation to create the Oracle database tables.


Overview

When we enter the Oracle user name in Ant file, it must be in uppercase. If you have an Oracle database user (FOO), but you enter a user name with lowercase (foo), the configureDatabase Ant task considers it as another user. Unlike other tools for Oracle database, the configureDatabase Ant task protects the user name against automatic conversion to uppercase.

The configureDatabase Ant task uses a service name or Oracle System Identifier (SID) to identify a database. However, if we want to make the connection to Oracle RAC, you need to enter a complex JDBC URL. In this case, the oracle element that is within the configureDatabase Ant task must use the attributes (url, user, and password) instead of these attributes (database, server, port, user, and password) attributes. For more information, see Table 17 in Ant configuredatabase task reference. The sample Ant files in mfp_install_dir/MobileFirstServer/configurations-samples use the database, server, port, user, and password attributes in the oracle element. They must be modified if you need to connect to Oracle with a JDBC URL.

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

To create a database, user, or the database tables, use the Oracle Database Creation Assistant (DBCA) tool. For more information, see Oracle database and user requirements.

The configureDatabase Ant task can do the same but with a limitation. The task can create a database user for Oracle 11g or Oracle 12g. However, it can create a database only for Oracle 11g, and not for Oracle 12c. Refer to the following two sections for the extra steps that you need to create the database or the user.

Parent topic: Create the database tables with Ant tasks


Creating the database


Before you begin

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


Procedure

  1. Run an SSH server on the computer that runs the Oracle database.

    The configureDatabase Ant task opens an SSH session to the Oracle host to create the database. Except on Linux and some versions of UNIX systems, the SSH server is needed even if the Oracle database runs on the same computer where you run the Ant tasks.

  2. In dba element that is defined in the create-database-oracle.xml file, enter the login ID and password of an Oracle database user that can connect to the Oracle Server via SSH and has the privileges to create a database. We can assign the values in the following properties:

    • database.oracle.admin.username
    • database.oracle.admin.password
  3. In oracle element, enter the database name that we want to create. The attribute is database. We can assign the value in the database.oracle.mfp.dbname property.
  4. In the same oracle element, also enter the password for the SYS user and the SYSTEM user for the database that is to be created. The attributes are sysPassword and systemPassword. We can assign the values in the corresponding properties:

    • database.oracle.sysPassword
    • database.oracle.systemPassword
  5. After all the database credentials are entered in the Ant file, save it and run the databases Ant target.


Results

A database is created with the SID name that is entered in the database of the oracle element. It is not meant to be used for production.


Creating the user


Before you begin

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


Procedure

  1. Run an SSH server on the computer that runs the Oracle database.

    The configureDatabase Ant task opens an SSH session to the Oracle host to create the database. Except on Linux and some versions of UNIX systems, the SSH server is needed even if the Oracle database runs on the same computer where you run the Ant tasks.

  2. In oracle element that is defined in the create-database-oracle.xml file, enter the login ID and password of an Oracle database user that you want to create. The attributes are user and password. We can assign the values in the corresponding properties:

    • database.oracle.mfp.username
    • database.oracle.mfp.password
  3. In the same oracle element, also enter the password for the SYSTEM user for the database. The attribute is systemPassword. We can assign the value in the database.oracle.systemPassword property.
  4. In dba element, enter the login ID and password of an Oracle database user that has the privileges to create a user. We can assign the values in the following properties:

    • database.oracle.admin.username
    • database.oracle.admin.password
  5. After all the database credentials are entered in the Ant file, save it and run the databases Ant target.


Results

A database user is created with the name and password that are entered in the oracle element. This user has the privileges to create the MobileFirst Server tables, upgrade them and use them at run time.