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.
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
Did you add the mysql driver jar in the classpath ?
There are not included by default.
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
Sorry I misunderstood the question, I’ve updated the answer
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 ?
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.