Connecting Flowable to mysql insted of H2

Hi All,
I want to configure mysql database with my flowable application can anyone suggest me how can i achieve this, which files do i need to edit in order to achieve this or can it be directly achieve without any code change please help.

Hi Anand!

You can configure the database through properties. In the following examples, I’m assuming that you properly set up your DB with a schema named flowable.

Configuration
If you are building a Spring app, you can simply add the following lines to your application.properties files located in your resources:

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flowable?characterEncoding=UTF-8
spring.datasource.username=flowable
spring.datasource.password=flowable

If you are not using Spring and configure your engines with the flowable.cfg file, you’ll have to add the following:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<!-- Data Source -->
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" >
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/flowable" />
    <property name="username" value="flowable" />
    <property name="password" value="flowable" />
    <property name="defaultAutoCommit" value="false" />
  </bean>
<!-- Rest of your configuration -->

</beans>

This will directly configure the data source of your application. You can also change the jdbcUrl, jdbcDriver, jdbcUsername and jdbcPassword directly, see here:
https://www.flowable.org/docs/userguide/index.html#databaseConfiguration

Connector
Also make sure that you add the dependeny to the connector to your pom.xml file:

<dependencies>
<!-- Other dependencies here -->

<!-- Connector -->
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.45</version>
</dependency>

<!-- Other stuff here -->

</dependencies>

Further references
You can also have a look at the following sections of the documentation:
Database configuration in general: https://www.flowable.org/docs/userguide/index.html#databaseConfiguration

Database configuration in Spring Boot: https://www.flowable.org/docs/userguide/index.html#_changing_the_database_and_connection_pool

Regards,
Matthias