Creating the Cloudant database

Before a project runtime can create or access a Cloudant® database, you need to configure Cloudant accounts and users. You might also need to specify database prefixes to distinguish projects that have the same name.

General requirements

To use the Cloudant database, you need either an account at Cloudant.com using the Cloudant database in the Cloud, or you need to install Cloudant Local on your own hardware, as described in IBM® Cloudant Data Layer Local Edition documentation.

Whether you use Cloudant.com or Cloudant Local, the Cloudant database is accessible via HTTP or HTTPS, and you need the URL to access it and a user name and password.

Cloudant account

Before a project runtime can create or access a Cloudant database at Cloudant.com, you must register a valid account for Cloudant.com. The account registration provides you with the following things:
Account name
The Cloudant account is implicitly also the URL; for example, the account exampleaccount corresponds to the URL https://exampleaccount.cloudant.com.
User name
By default, the account name serves also as administrator user name of the databases created in your account. Access is granted per database. By default, all databases that you create are only accessible to your account. If you are using a shared database that is accessible to multiple users, you need a user name that has sufficient permissions to write and read documents of the database.
Password
A password to access the account at Cloudant.com.

See Sign Up for a Free Account for information about how to create an account on Cloudant.com.

Cloudant Local

If you use a Cloudant Local installation instead of Cloudant.com, you must configure the following things:

  • The URL to access your Cloudant Local installation.
  • A user name to access your Cloudant Local installation, which has sufficient permissions to write and read documents in the database.
  • A password for this user in your Cloudant Local installation.

For more information about how to create and administer users for Cloudant Local, see Configuring database-level security.

Permissions

The default permissions for a new account at Cloudant.com or at Cloudant Local are sufficient for the project runtime.

The database can be created through the Cloudant dashboard. The user must have at least the following roles set for your database:

_reader
Gives the user permission to read documents from the database.
_writer
Gives the user permission to create and modify documents in the database.
_admin
Gives the user permission to install and update design documents in the database.

Unlike relational databases, there is no concept of "tables" in Cloudant, hence there is no need to create any tables ahead of time or to set any permissions on tables. If the database is not yet created, it will be automatically created when the project runtime is launched on the application server. In this case, the user name must be set to the administrator user name of the Cloudant account, because only the administrator has permission to create new databases.

Default database name for project runtimes

Each deployed project needs to have a separate database. By default, the name of this database is in the following form:

{project_name}_runtime_db

where {project_name} is the context root of the project without the leading forward slash.

If multiple teams use the same database with projects that have the same names, they can specify a prefix through a "dBNamePrefix" at deployment time to distinguish each project either manually or with Ant tasks. For more information about how to use this prefix manually for the application server to which you plan to deploy your MobileFirst runtime, see the relevant subsection in Deploying a project WAR file and configuring the application server manually. For more information about how to use this prefix with Ant tasks, see Ant tasks for installation of MobileFirst runtime environments, Attributes of the <cloudant> element.

Note:

Databases for projects are created if needed after deployment when the project is launched.