Step 1: Creating a data source

Create a data source to connect to the Decision Center database.

Before you begin

Unless you are using H2 embedded, you must have a database before creating a data source (see Mandatory: Create the databases).

For a list of supported databases, consult the platform support details available on the IBM support site.

About this task

To connect to the Decision Center database on the WebSphere® Liberty profile, copy your database driver to the WebSphere Liberty profile directory and declare the data source.

Procedure

  1. Copy the database driver to a directory, which you then specify in the server.xml file when you declare the data source.
    For example, the H2 embedded database driver is H2.jar, available in <InstallDir>/shared/tools/H2/lib. Copy the driver to the <WLP_HOME>/usr/shared/resources/H2 directory.
  2. In <WLP_HOME>/usr/servers/<SERVER_NAME>/server.xml, declare the data source:
    <!-- Decision Center data source -->
    <jdbcDriver id="H2JdbcDriver" libraryRef="H2Lib"/>
    <library id="H2Lib" filesetRef="H2Fileset"/>
    <fileset id="H2Fileset" dir="${shared.resource.dir}/H2" includes="H2.jar"/>
    <dataSource
       id="H2Embedded"
       isolationLevel="TRANSACTION_READ_COMMITTED"
       jndiName="jdbc/ilogDataSource" jdbcDriverRef="H2JdbcDriver">
       <properties.H2.embedded
          databaseName="${server.config.dir}/H2/dcdb"
          createDatabase="create"
          user="dcdbUser"
          password="dcdbUser"/>
    </dataSource>
  3. Adjust the properties for local transaction data sources:
    driver path
    The <fileset> tag specifies the path to the driver that is used to handle the connections to the database. For example, for the H2 embedded database.
    isolationLevel
    Set the tag isolationLevel to TRANSACTION_READ_COMMITTED to avoid database access problems and hence provide a better concurrency experience.
    username and password
    The properties user="dcdbUser" and password="dcdbUser" are only used to access the database.
    database name
    The property databaseName="${server.config.dir}/H2/dcdb" provides the JDBC connection. A database named dcdb is created the first time you access Decision Center.
  4. Save the file.