Configure MySQL Database


I am installing Camunda with MySQL database on Wildfly however I have not made it work.

Please, can you help me.

Install the Camunda WAR in Wildfly and I am configuring MySQL using the applicationContext.xml file as the image.

Additionally, the drive and datasource in Wildfly were configured to work correctly.

Should any additional configuration be made?

Thanks for the help if you can send me an example of the configuration file I would appreciate it.

Thank you

Hi @aarchilac,

Hope this will helpful for you.

start the Command Line Interface:

1 $ . /jboss-cli .sh -c

We will The following command will install the com.mysql module creating for you the module directory structure:

1 module add --name=com.mysql --resources= /var/mysql-connector-java-5 .1.31-bin.jar --dependencies=javax.api,javax.transaction.api

Next, we need to install the JDBC driver using the above defined module:

1 /subsystem =datasources /jdbc-driver =mysql:add(driver-name=mysql,driver-module-name=com.mysql)

Finally, install the data source by using the data-source shortcut command, which requires as input the Pool name, the JNDI bindings, the JDBC Connection parameters and finally the security settings. Assumed that the MySQL Database is available at the IP Address

1 data- source add --jndi-name=java: /MySqlDS --name=MySQLPool --connection -url=jdbc:mysql: //172 .17.0.2:3306 /mysqlschema --driver-name=mysql --user-name=jboss --password=jboss

You can check that the datasource has been installed correctly by issuing the following command:

1 /subsystem =datasources /data-source =MySQLPool: test -connection- in -pool

Thanks for the answer … however it made the driver configuration and datasource working correctly.

Could you help me to know how it made the connection between WAR and Datasource. As a change so that it recognizes the new datasource and not H2.

Thank you

1 Like

Yes Sure, Please check this answer I Hope it will helpful for you.

You will get the connection using below JNDI Look up:

private DataSource getDataSource (String dataSourceLocation) throws NamingException
    // Get a context for the JNDI look up
    Context ctx = new InitialContext();
    Context envContext = (Context) ctx.lookup("java:/comp/env");

    // Look up a data source
    javax.sql.DataSource ds
      = (javax.sql.DataSource) envContext.lookup (dataSourceLocation); 

    return ds;

  private Connection getConnection (DataSource ds) throws SQLException
    Connection conn = null;
    // Get a connection object
    conn = ds.getConnection();

    return conn;

Note: The dataSouceLocation would be “jdbc/UCPPool”.