eXo Platform 3.0

- Prev
- Next

## Chapter 68. DB Schema creator service (JDBC implementation)

DB Schema Creator is responsible for creating database schema, using a DDL script inside service configuration or in an external file, calling:

      org.exoplatform.services.database.jdbc.DBSchemaCreator.createTables(String dsName, String script)

via

    org.exoplatform.services.database.jdbc.CreateDBSchemaPlugin component plugin

A configuration example:

    <component>
       <key>org.exoplatform.services.database.jdbc.DBSchemaCreator</key>
       <type>org.exoplatform.services.database.jdbc.DBSchemaCreator</type>
       <component-plugins>
          <component-plugin>
             <name>jcr.dbschema</name>
             <set-method>addPlugin</set-method>
             <type>org.exoplatform.services.database.jdbc.CreateDBSchemaPlugin</type>
             <init-params>
                <value-param>
                   <name>data-source</name>
                   <value>jdbcjcr</value>
                </value-param>
                <value-param>
                   <name>script-file</name>
                   <value>conf/storage/jcr-mjdbc.sql</value>
                </value-param>
             </init-params>
          </component-plugin>
      ........

An example of a DDL script:

    CREATE TABLE JCR_MITEM(
            ID VARCHAR(255) NOT NULL PRIMARY KEY,
            VERSION INTEGER NOT NULL,
            PATH VARCHAR(1024) NOT NULL
            );
    CREATE INDEX JCR_IDX_MITEM_PATH ON JCR_MITEM(PATH);

- Prev
- Up
- Home
- Next