Child pages
  • OpenIDM 3.0 - Using OpenIDM With a PostgreSQL Repository
Skip to end of metadata
Go to start of metadata

By default, OpenIDM uses OrientDB for its internal repository so that you do not have to install a database in order to evaluate OpenIDM. Before using OpenIDM in production, however, you must replace OrientDB with a supported repository.

OpenIDM 3.0 (trunk) supports the use of MySQL, MS SQL, and Oracle Database as an internal repository. Use of PostGreSQL as a repository has been minimally tested but is not yet supported in production environments. This article describes how to set up OpenIDM with PostGreSQL, for testing purposes.

This procedure assumes that PostgreSQL (version 9.3 or later) is installed and running on the local host.

Before starting OpenIDM for the first time, set up OpenIDM to use a PostGreSQL repository, as described in the following procedure.

  1. OpenIDM includes a script (path/to/openidm/db/scripts/postgresql/createuser.pgsql) that sets up an openidm database and user, and grants the appropriate permissions.

    Edit this script to set a password for the openidm user that will be created. The default password is openidm.

    $ more /path/to/openidm/db/scripts/postgresql/createuser.pgsql 
    create user openidm with password 'mypassword'; 
    create database openidm encoding 'utf8' owner openidm;
    grant all privileges on database openidm to openidm;
  2. Execute the createuser.pgsql script as follows:

    $ psql < /path/to/openidm/db/scripts/postgresql/createuser.pgsql 
    CREATE ROLE 
    CREATE DATABASE
    GRANT
  3. Execute the openidm.pgsql script as the new openidm user that you created in the first step.

    $ psql -U openidm < /path/to/openidm/db/scripts/postgresql/openidm.pgsql 
    CREATE SCHEMA 
    CREATE TABLE
    CREATE TABLE
    CREATE TABLE
    CREATE INDEX
    CREATE INDEX
    ...
    START TRANSACTION
    INSERT 0 1
    INSERT 0 1
    COMMIT
    CREATE INDEX
    CREATE INDEX

    Your database has now been initialized.
     

  4. Remove the OrientDB repository configuration file (conf/repo.orientdb.json).

    $ rm /path/to/openidm/conf/repo.orientdb.json
        
  5. Copy the PostGreSQL repository configuration file (samples/misc/repo.jdbc-postgres.json) to the configuration directory, and rename it repo.jdcb.json.

    $ cd /path/to/openidm
    $ cp samples/misc/repo.jdbc-postgres.json conf/repo.jdbc.json
        
  6. If you changed the password in step 1 of this procedure, edit the repo.jdcb.json file to set the value for the"password" field to whatever password you set for the openidm user. For example:

    $ more conf/repo.jdbc.json 
    { 
    "connection" : {
    "dbType" : "POSTGRESQL",
    "jndiName" : "",
    "driverClass" : "org.postgresql.Driver",
    "jdbcUrl" : "jdbc:postgresql://localhost:5432/openidm",
    "username" : "openidm",
    "password" : "mypassword",
    ....
  7. PostgreSQL is now set up for use as the OpenIDM internal repository.

    Start OpenIDM to check that the setup has been successful. After startup, you should see that repo.jdbc isactive, whereas repo.orientdb is unsatisfied.
     

  8. If you are using the default project configuration, run the default_schema_optimization.pgsql script to create the required indexes. The file includes extensive comments on the indexes that are being created.

    $ psql -U postgres openidm < /path/to/openidm/db/scripts/postgresql/default_schema_optimization.pgsql






  • No labels