Error when connecting to MySQL 5.5 in bonita community 2021.2

1
0
-1

Hi All,

I am trying to connect to a MySQL 5.5 database using the connector available in Bonita. I get the following error.

java.lang.reflect.InvocationTargetException
org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: USERNAME=install | org.bonitasoft.engine.core.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: org.bonitasoft.engine.commons.exceptions.SBonitaRuntimeException: org.bonitasoft.engine.connector.exception.SConnectorException: org.bonitasoft.engine.connector.ConnectorException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

How to fix it? I am using Bonita Community 2021.2

Thank you.

Comments

Submitted by romain.bioteau on Tue, 10/19/2021 - 10:36

Did you add the mysql driver jar in the classpath ?
There are not included by default.

Submitted by Hasitha on Thu, 10/21/2021 - 05:19

Hi,

Thank you for the reply.How to add dependencies? Is there a document on this and what are the supported versions.

Thank you.

1 answer

1
0
-1
This one is the BEST answer!

Hi,

You can have a look at this documentation page to check the supported MySql versions and this one for the configuration

UPDATE:

If you want to use the Database connector to connect to a MySQL database. You can configure Database driver when adding the connector in your project from the Overview > Extension view > Open Marketplace. Choose the database connector.

Then you'll be asked if you want to add a database driver. Click on Yes. Choose the MySQL driver. We provided a specific version, but you'll just need to validate that this version of the driver is compatible with your MySQL version. You can change the version of the driver dependency in the Extension view.

Then in process you can add a MySql connector (note that the 5.5 version is irrelevant, it uses the JDBC API, which will work whatever the MySQL version). You should see the driver binding during the configuration. The driver jar is by default automatically added to the process classpath. You can check the latter using the Configure action on a process and navigate to the Java dependencies tab. The driver jar should be selected in the Other category.

HTH
Romain

Comments

Submitted by Hasitha on Thu, 10/21/2021 - 10:42

Hi thank you for the reply, What I tried to do was to create a process that makes an api call to external free api, retrieve data from the response,log it, send email and write that data to a MySQL database. I was able to call the external api and send email using the default connectors available, only database part failed. So in that scenario do I have to do the above mentioned configurations provided in documentation for databases?. Based on the documentations those are for Bonita Engine and Business Data Model during Runtime configuration

Submitted by romain.bioteau on Thu, 10/21/2021 - 15:13

Sorry I misunderstood the question, I've updated the answer

Submitted by Hasitha on Fri, 10/22/2021 - 06:42

Hi got it working using your guidance but having difficulty in inserting BDM variables to the data base. I am using following query

INSERT INTO `bonitadb`.`weathertable` (`location`, `State`)
VALUES ('london', ${weatherState.weather_state_name.toString()})

I am getting "input parameter script uses unreachable expression"

How to access those variable correctly ?

Submitted by romain.bioteau on Fri, 10/22/2021 - 09:15

Can you try to switch the sql script editor to the expression editor and write a groovy script expression like this:

"""INSERT INTO `bonitadb`.`weathertable` (`location`, `State`)
    VALUES ('london', $weatherState.weather_state_name)"
""

If you deselect the automatic dependency resolution, you should see that your business data weatherState has been resolved.

Notifications