| [id='eap-data-source-add-proc_{context}'] |
| |
| = Configuring JDBC data sources for {KIE_SERVER} |
| A data source is an object that enables a Java Database Connectivity (JDBC) client, such as an application server, to establish a connection with a database. Applications look up the data source on the Java Naming and Directory Interface (JNDI) tree or in the local application context and request a database connection to retrieve data. You must configure data sources for {KIE_SERVER} to ensure proper data exchange between the servers and the designated database. |
| |
| [NOTE] |
| ==== |
| For production environments, specify an actual data source. Do not use the example data source in production environments. |
| ==== |
| |
| .Prerequisites |
| * The JDBC providers that you want to use to create database connections are configured on all servers on which you want to deploy {KIE_SERVER}, as described in the "Creating Datasources" and "JDBC Drivers" sections of the https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/{EAP_VERSION}/html/configuration_guide/index[_Red Hat JBoss Enterprise Application Server Configuration Guide_]. |
| * The {PRODUCT} {PRODUCT_VERSION_LONG} Add Ons ({PRODUCT_FILE}-add-ons.zip) file is downloaded from the https://access.redhat.com/jbossnetwork/restricted/listSoftware.html[Software Downloads] page in the Red Hat Customer Portal. |
| |
| .Procedure |
| . Complete the following steps to prepare your database: |
| .. Extract `{PRODUCT_INIT}-{PRODUCT_VERSION_LONG}-add-ons.zip` in a temporary directory, for example `TEMP_DIR`. |
| .. Extract `TEMP_DIR/{PRODUCT_INIT}-{PRODUCT_VERSION_LONG}-migration-tool.zip`. |
| .. Change your current directory to the `TEMP_DIR/{PRODUCT_INIT}-{PRODUCT_VERSION_LONG}-migration-tool/ddl-scripts` directory. This directory contains DDL scripts for several database types. |
| .. Import the DDL script for your database type into the database that you want to use, for example: |
| + |
| [source,shell] |
| ---- |
| psql jbpm < /ddl-scripts/postgresql/postgresql-jbpm-schema.sql |
| ---- |
| + |
| [NOTE] |
| ==== |
| If you are using PostgreSQL or Oracle in conjunction with Spring Boot, you must import the respective Spring Boot DDL script, for example `/ddl-scripts/oracle/oracle-springboot-jbpm-schema.sql` or `/ddl-scripts/postgresql/postgresql-springboot-jbpm-schema.sql`. |
| ==== |
| + |
| [NOTE] |
| ==== |
| The PostgreSQL DDL scripts create the PostgreSQL schema with auto-incrementing integer value (OID) columns for entity attributes annotated with @LOB. To use other binary column types such as BYTEA instead of OID, you need to create the PostgreSQL schema with the `postgresql-bytea-jbpm-schema.sql` script and set the {PRODUCT} `org.kie.persistence.postgresql.useBytea=true` flag. {PRODUCT} does not provide a migration tool to change from an OID-based to a Bytea-based schema. |
| ==== |
| |
| . Open `_EAP_HOME_/standalone/configuration/standalone-full.xml` in a text editor and locate the `<system-properties>` tag. |
| . Add the following properties to the `<system-properties>` tag where `<DATASOURCE>` is the JNDI name of your data source and `<HIBERNATE_DIALECT>` is the hibernate dialect for your database. |
| + |
| [NOTE] |
| ==== |
| The default value of the `org.kie.server.persistence.ds` property is `java:jboss/datasources/ExampleDS`. The default value of the `org.kie.server.persistence.dialect` property is `org.hibernate.dialect.H2Dialect`. |
| ==== |
| + |
| [source,xml] |
| ---- |
| <property name="org.kie.server.persistence.ds" value="<DATASOURCE>"/> |
| <property name="org.kie.server.persistence.dialect" value="<HIBERNATE_DIALECT>"/> |
| ---- |
| + |
| The following example shows how to configure a datasource for the PostgreSQL hibernate dialect: |
| + |
| [source,xml,subs="attributes+"] |
| ---- |
| <system-properties> |
| <property name="org.kie.server.repo" value="${jboss.server.data.dir}"/> |
| <property name="org.kie.example" value="true"/> |
| <property name="org.jbpm.designer.perspective" value="full"/> |
| <property name="designerdataobjects" value="false"/> |
| <property name="org.kie.server.user" value="{PRODUCT_INIT}User"/> |
| <property name="org.kie.server.pwd" value="{PRODUCT_INIT}123!"/> |
| <property name="org.kie.server.location" value="http://localhost:8080/kie-server/services/rest/server"/> |
| <property name="org.kie.server.controller" value="http://localhost:8080/{URL_COMPONENT_CENTRAL}/rest/controller"/> |
| <property name="org.kie.server.controller.user" value="kieserver"/> |
| <property name="org.kie.server.controller.pwd" value="kieserver1!"/> |
| <property name="org.kie.server.id" value="local-server-123"/> |
| |
| <!-- Data source properties. --> |
| <property name="org.kie.server.persistence.ds" value="java:jboss/datasources/KieServerDS"/> |
| <property name="org.kie.server.persistence.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> |
| </system-properties> |
| ---- |
| |
| The following dialects are supported: |
| |
| * DB2: `org.hibernate.dialect.DB2Dialect` |
| * MSSQL: `org.hibernate.dialect.SQLServer2012Dialect` |
| * MySQL: `org.hibernate.dialect.MySQL5InnoDBDialect` |
| * MariaDB: `org.hibernate.dialect.MySQL5InnoDBDialect` |
| * Oracle: `org.hibernate.dialect.Oracle10gDialect` |
| * PostgreSQL: `org.hibernate.dialect.PostgreSQL82Dialect` |
| * PostgreSQL plus: `org.hibernate.dialect.PostgresPlusDialect` |
| * Sybase: `org.hibernate.dialect.SybaseASE157Dialect` |