configuredatabase Ant task
The configuredatabase Ant task creates the databases used by administrative services and the runtime.
- Checks whether the MobileFirst tables exist and creates them if necessary.
- If the tables exist for an older version of MPF, migrates them to the current version.
- If the tables exist for the current version of MPF, does nothing.
If the inner element <dba> is present, the task can have the following effects:
- Create the database
- Create a user, and grant user access rights to the database
The WorklightAdmin database is used for administration services. This database can support multiple MobileFirst runtimes. If we upgrade from a Worklight version earlier that v6.2.0, also migrate the data from the Worklight runtime to the new database for administrative services. Worklight Foundation v6.2.0 introduced a new element, admindatabase, for this purpose, as shown in Table 2.
Attributes and elements for configuredatabase
configuredatabase attributes...
Attribute Description Required Default kind Type of database:
- Worklight
- WorklightReports
- WorklightAdmin
Yes None ...where...
- Runtimes use Worklight and WorklightReports databases
- Administrative services use WorklightAdmin database.
The configuredatabase task supports the following elements:
Element Description Count derby Parameters for Derby 0..1 db2 Parameters for DB2 0..1 mysql Parameters for MySQL 0..1 oracle Parameters for Oracle 0..1 driverclasspath JDBC driver class path 0..1 admindatabase Parameters for migrating data from v6.1.x runtime to v6.3.0 administration services database 0..1 Use a <property> element to specify a JDBC connection property for access to the database, using attributes...
Attribute Description Required Default name Name of the property Yes None value Value for the property Yes None
Attributes and elements for admindatabase
Use the <admindatabase> element for migrating data from a MobileFirst runtime database to the administrative services database. This element is mandatory when you migrate your Worklight runtime projects from v6.1.x and the kind attribute of configuredatabase is Worklight.
The admindatabase element has the following attribute.
Because the administrative services can handle one or more MobileFirst runtimes, we must reference a specific context root for each runtime. Use the runtimeContextRoot attribute to specify this context root. After MobileFirst data is migrated, we cannot change the context root of the MobileFirst runtime, unless the administrative services database is removed and a new database is created.
Attribute Description Required Default runtimeContextRoot Context root of the MobileFirst runtime Yes None The <admindatabase> element supports the following elements.
Element Description Count derby Parameters for Derby 0..1 db2 Parameters for DB2 0..1 driverclasspath JDBC driver class path 0..1 mysql Parameters for MySQL 0..1 oracle Parameters for Oracle 0..1
Apache Derby
The <derby> element has the following attributes:
Attribute Description Required Default database Database name No WRKLGHT, WLREPORT, or WLADMIN, depending on kind. datadir Directory containing the databases Yes None schema Schema name No WORKLIGHT, WORKLIGHT, or WLADMINISTRATOR, depending on kind The <derby> element supports the following elements:
Element Description Count property JDBC connection property 0..∞ For the available properties, see Set attributes for the database connection URL.
DB2
The <db2> element has the following attributes:
Attribute Description Required Default database Database name No WRKLGHT, WLREPORT, or WLADMIN, depending on kind server Host name of the database server Yes None port Port on the database server No 50000 user User name for accessing databases Yes None password Password for accessing databases No Queried interactively instance Name of the DB2 instance No Depends on the server schema Schema name No Depends on the user For more information about DB2 user accounts, see DB2 security model overview.
The <db2> element supports the following elements:
Element Description Count property JDBC connection property 0..∞ dba Database administrator credentials 0..1 For the available properties, see Properties for the Data Server Driver for JDBC and SQLJ.
The inner element <dba> specifies credentials for database administrators. This element has the following attributes:
Attribute Description Required Default user User name for accessing database Yes None password Password or accessing database No Queried interactively User specified in a <dba> element must have the SYSADM or SYSCTRL DB2 privilege. See Authorities overview.
The <driverclasspath> element must contain JAR files for the DB2 JDBC driver and for the associated license. We can retrieve those files in one of the following ways:
- Download DB2 JDBC drivers from the DB2 JDBC Driver Versions page
- Or fetch the db2jcc4.jar file and its associated db2jcc_license_*.jar files from the DB2_INSTALL_DIR/java directory on the DB2 server.
We cannot specify details of table allocations, such as the table space, using the Ant task. To control the table space, use the manual instructions in section Configure the DB2 databases manually.
MySQL
The element <mysql> has the following attributes:
Attribute Description Required Default database Database name No WRKLGHT, WLREPORT, or WLADMIN, depending on kind server Host name of the database server Yes None port Port on the database server No 3306 user User name for accessing databases Yes None password Password for accessing databases No Queried interactively For more information about MySQL user accounts, see MySQL User Account Management.
The <mysql> element supports the following elements:
Element Description Count property JDBC connection property 0..∞ dba Database administrator credentials 0..1 client The host allowed to access the database 0..∞ For the available properties, see Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J.
The inner element <dba> specifies database administrator credentials. This element has the following attributes:
Attribute Description Required Default user User name for accessing databases Yes None password Password for accessing databases No Queried interactively User specified in a <dba> element must be a MySQL superuser account. See Secure the Initial MySQL Accounts.
Each <client> inner element specifies a client computer or a wildcard for client computers. These computers are allowed to connect to the database. This element has the following attributes:
Attribute Description Required Default hostname Symbolic host name, IP address, or template with % as a placeholder Yes None For more information about the hostname syntax, see Specify Account Names.
The <driverclasspath> element must contain a MySQL Connector/J JAR file. We can download that file from the Download Connector/J page.
Alternatively, we can use the <mysql> element with the following attributes:
Attribute Description Required Default url Database connection URL Yes None user User name for accessing databases Yes None password Password for accessing databases No Queried interactively If we specify the database with the alternative attributes, this database must exist, the user account must exist, and the database must already be accessible to the user. In this case, the configuredatabase task does not attempt to create the database or the user, nor does it attempt to grant access to the user. The configuredatabase task ensures only that the database has the required tables for the current MobileFirst Server version. We do not have to specify the inner elements <dba> or <client>.
Oracle
The element <oracle> has the following attributes:
Attribute Description Required Default database Database name No ORCL server Host name of the database server Yes None port Port on the database server No 1521 user User name for accessing databases. See the note under this table. Yes None password Password for accessing databases No Queried interactively sysPassword Password for the user SYS No Queried interactively if the database does not yet exist systemPassword Password for the user SYSTEM No Queried interactively if the database or the user does not exist yet For the user attribute, use preferably a user name in uppercase letters. Oracle user names are generally in uppercase letters. Unlike other database tools, the configuredatabase Ant task does not convert lowercase letters to uppercase letters in the user name. If the configuredatabase Ant task fails to connect to the database, try to enter the value for the user attribute in uppercase letters.
For more information about Oracle user accounts, see Overview of Authentication Methods.
The <oracle> element supports the following elements:
For information about the available connection properties, see Class OracleDriver.
Element Description Count property JDBC connection property 0..∞ dba Database administrator credentials 0..1 The inner element <dba> specifies database administrator credentials. This element has the following attributes:
Attribute Description Required Default user User name for accessing databases Yes None password Password for accessing databases No Queried interactively The <driverclasspath> element must contain an Oracle JDBC driver JAR file. We can download Oracle JDBC drivers from JDBC, SQLJ, Oracle JPublisher and Universal Connection Pool (UCP).
We cannot specify details of table allocation, such as the table space, using the Ant task. To control the table space, create the user account manually and assign it a default table space before running the Ant task. To control other details, use the manual instructions in section Configure the Oracle databases manually.
Alternatively, we can use the <oracle> element with the following attributes:
Attribute Description Required Default url Database connection URL Yes None user User name for accessing databases Yes None password Password for accessing databases No Queried interactively If we specify the database with the alternative attributes, this database must exist, the user account must exist, and the database must already be accessible to the user. In this case, the task does not attempt to create the database or the user, nor does it attempt to grant access to the user. The configuredatabase task ensures only that the database has the required tables for the current MobileFirst Server version. We do not have to specify the inner element <dba>.
Parent topic: Reference