5.5 Creating a DB2 database

Create a DB2 database by running one of the scripts provided in this section. The script is tuned for a system that will use 1 GB of memory for the database. If your system has less memory dedicated for the database, see the appropriate DB2 documentation for details about configuring your system settings. LiveCycle supports DB2 with WebSphere 7.0, and WebLogic 11g.

You need the following information when you configure the data source on the application server:

  • Database name

  • User name and password of the DB2 user account

  • Host name or IP address of the database server

  • DB2 port number

5.5.1 DB2 user account

LiveCycle requires a dedicated system database account. If the account is the schema owner no other privileges are required. The schema owner can alter, create and drop any object in the schema. If the account is not the schema owner then the ALTERIN, CREATEIN AND DROPIN schema privileges are required. The user will also have to belong to the DB2USERS group.

The DB2 user account needs to have schema owner rights to create tables both at product installation time and system runtime. The application server may add further requirements to the database user and schema due to its internal use of the database.

For information about creating a user account, see the DB2 documentation.

For deployments on AIX, Linux, or Solaris, the user name must not exceed 8 characters; on Windows, it must not exceed 12 characters.

5.5.2 Create the DB2 database

 (Content Services not included) On the computer that hosts DB2, create a new text file that includes the following DB2 script for your database version.

Note: The following text contains formatting characters for line breaks. When you copy this text to a location outside this document, remove the formatting characters.
-- Create a database, using a custom USERSPACE1 definition 
-- Configures the database for typical LC use. For large number of connections, add: 
--     num_remote_apps 
-- to the AUTOCONFIGURE section 
-- To use: Globally replace (case sensitive) DB_NAME with the name of the database to be created. 
-- Modify the FILE locations based on system configuration 
-- Note: The size of the file has to be specified in pages (4K pages in this case) when used as part of the create database command 
create database DB_NAME using codeset utf-8 territory default 
USER TABLESPACE MANAGED BY DATABASE USING (FILE'C:\Db2\DB_NAME\DATA_4K_1.db2' 8192) AUTORESIZE YES 
AUTOCONFIGURE using workload_type mixed isolation CS admin_priority performance apply DB and DBM; 
-- Create required buffer pools. Let the DB manage the sizes based on load. 
-- Creates 8K pool for LC 
-- Let DB2 manage the sizes based on usage patterns 
connect to DB_NAME; 
CREATE BUFFERPOOL DB_NAME_BP8K IMMEDIATE SIZE AUTOMATIC PAGESIZE 8192; 
ALTER BUFFERPOOL IBMDEFAULTBP IMMEDIATE SIZE AUTOMATIC; 
connect reset; 
-- Create required tablespaces for tables requiring 8K and 32K pools. 
connect to DB_NAME; 
-- 8K tablespace used by a number of tables. 
-- Note that the majority of data is stored in the 4K tablespace (created as part of the databse create) 
CREATE TEMPORARY TABLESPACE DB_NAME_TEMP_8K IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 8192 MANAGED BY SYSTEM 
USING ('C:\Db2\DB_NAME\TEMP_8K') PREFETCHSIZE AUTOMATIC BUFFERPOOL DB_NAME_BP8K; 
-- Start off large enough to allow a reasonable test to run without needing to extend the space 
-- Should be modified to fit expected usage patterns 
CREATE LARGE TABLESPACE DB_NAME_DATA_8K IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8192 MANAGED BY 
DATABASE USING (FILE'C:\Db2\DB_NAME\DATA_8K.db2'1G) 
PREFETCHSIZE AUTOMATIC BUFFERPOOL DB_NAME_BP8K AUTORESIZE YES INCREASESIZE 1 G; 
commit work; 
connect reset; 
deactivate database DB_NAME; 
activate database DB_NAME;

 (Content Services included) If you are using Content Services with any of the other LiveCycle modules, use the following DB2 script for your database version:

Note: The following text contains formatting characters for line breaks. When you copy this text to a location outside this document, remove the formatting characters.
-- Create a database, using a custom USERSPACE1 definition 
-- Configures the database for typical LC use. For large number of connections, add: 
--     num_remote_apps 
-- to the AUTOCONFIGURE section 
-- To use: Globally replace (case sensitive) DB_NAME with the name of the database to be created. 
-- Modify the FILE locations based on system configuration 
-- Note: The size of the file has to be specified in pages (4K pages in this case) when used as part of the create database command 
create database DB_NAME using codeset utf-8 territory default 
USER TABLESPACE MANAGED BY DATABASE USING (FILE'C:\Db2\DB_NAME\DATA_4K_1.db2' 8192) AUTORESIZE YES 
AUTOCONFIGURE using workload_type mixed isolation CS admin_priority performance apply DB and DBM; 
-- Create required buffer pools. Let the DB manage the sizes based on load. 
-- Creates 8K pool for LC and 32K for Content Services use 
-- LEt DB2 manage the sizes based on usage patterns 
connect to DB_NAME; 
CREATE BUFFERPOOL DB_NAME_BP8K IMMEDIATE SIZE AUTOMATIC PAGESIZE 8192; 
CREATE BUFFERPOOL DB_NAME_BP32K IMMEDIATE SIZE AUTOMATIC PAGESIZE 32768; 
ALTER BUFFERPOOL IBMDEFAULTBP IMMEDIATE SIZE AUTOMATIC; 
connect reset; 
-- Create required tablespaces for tables requiring 8K and 32K pools. 
connect to DB_NAME; 
-- 8K tablespace used by a number of tables. 
-- Note that the majority of data is stored in the 4K tablespace (created as part of the databse create) 
CREATE TEMPORARY TABLESPACE DB_NAME_TEMP_8K IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 8192 MANAGED BY SYSTEM 
USING ('C:\Db2\DB_NAME\TEMP_8K') PREFETCHSIZE AUTOMATIC BUFFERPOOL DB_NAME_BP8K; 
-- Start off large enough to allow a reasonable test to run without needing to extend the space 
-- Should be modified to fit expected usage patterns 
CREATE LARGE TABLESPACE DB_NAME_DATA_8K IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8192 MANAGED BY 
DATABASE USING (FILE'C:\Db2\DB_NAME\DATA_8K.db2'1G) 
PREFETCHSIZE AUTOMATIC BUFFERPOOL DB_NAME_BP8K AUTORESIZE YES INCREASESIZE 1 G; 
-- For Content Services - Size has to change based on anticipated use.  Sample values provided 
CREATE TEMPORARY TABLESPACE DB_NAME_TEMP_32K IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 32768 MANAGED BY SYSTEM 
USING ('C:\Db2\DB_NAME\TEMP_32') PREFETCHSIZE AUTOMATIC BUFFERPOOL DB_NAME_BP32K; 
CREATE LARGE TABLESPACE DB_NAME_DATA_32K IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 32768 MANAGED BY 
DATABASE USING (FILE'C:\Db2\DB_NAME\DATA_32K.db2'1G) PREFETCHSIZE AUTOMATIC BUFFERPOOL DB_NAME_BP32K AUTORESIZE YES INCREASESIZE 1 G; 
commit work; 
connect reset; 
deactivate database DB_NAME; 
activate database DB_NAME; 
  1. Make the following changes to the script:

    • Replace the instances of dbname and DBNAME with the name you want for the LiveCycle database.

    • If you are creating multiple database instances on the same host, create an uniquely named buffer pool (for example, BP8K_1) for each database instance, using a buffer pool size such that all will not exceed 10% of total physical memory. For example, on a machine with 1GB of physical memory, the total buffer pool size should not exceed 100MB (“SIZE 100000”)

    • Replace DB2_root with the path to the root directory where DB2 is installed.

    • Ensure that no commands include line breaks and each command is terminated by a semicolon (;).

    • Change 9000 in the following line based on your database size:

    (FILE'DB2_root\DBNAME_DATA'9000)

    This number specifies the minimum number of pages required to initialize the database. You can also change this number by using the DB2 administration tools after you initialize the database.

  2. Save the text file in a location that DB2 Command Line Processor can access.

  3. Open a DB2 command prompt and type the following command to run the script:

db2 -tf <path_to_script_file>/<script_file_name>

5.5.3 Configure DB2 for concurrent usage

  1. Open the DB2 Control Center:

    • (Windows) Select Start > Programs > IBM DB2 > General Administration Tools > Control Center.

    • (AIX, Linux, and Solaris ) From a command prompt, enter the command db2jcc.

  2. In the DB2 Control Center object tree, click All Databases.

  3. Right-click the database created for LiveCycle products and click Configuration Advisor.

  4. Follow the steps in the Configuration Advisor wizard and set the following properties:

    DB2 Property

    Required Value

    Workload type

    Mixed

    Average number of SQL transactions per unit of work

    Less than 10

    Database Administration Priority

    Faster transaction performance

    Populated Database

    Set according to the current state of the database instance. The instance is not populated if it has not yet been initialized by the Configuration Manager.

    Isolation Level

    Read Committed

  5. Click Finish.

5.5.4 Add a user to the new database

  1. Log in to the IBM Control Center.

  2. Click [database_name] > User and Group Objects > DB Users.

  3. Select Add User and select the user.

  4. Under Authorities, select Connect to database, Create tables, and Database administration authority, and then select Apply.

  5. Click OK.

5.5.5 Additional DB2 requirements for Content Services

The script described in step 2 in 5.5.2 Create the DB2 database creates an additional DB2 database page size and sets it to 32 KB. If Content Services is not being deployed, the default DB2 database page size of 8 KB is acceptable.

5.5.5.1 Configuring multiple DB2 schemas

When configuring Content Services to run using multiple schemas on a single DB2 database instance, Content Services deployment will succeed on the first node but fail on all subsequent nodes. DB2 is case-sensitive and expects to receive values in uppercase letters. To avoid this problem, you must add the following JVM argument to your application server:

-Dhibernate.default_schema=<schema_name>

Note: <schema_name> must be replaced by the schema name in uppercase letters.

// Ethnio survey code removed