Default database connector configuration
The Bonita Studio includes a generic database connector that allows both JDBC and Datasource configurations
There are two types of configuration for database connectors:
-
A JDBC connector is a point-to-point connection configured with information to access the database directly.
-
A datasource connector is a connection to a datasource that is an intermediate point between the user (the Bonita process) and the database.
The advantage of using a datasource is that it can use a connection pool. The details of how the datasource retrieves information and the database it uses are hidden from the connector.
How to configure a JDBC connector
These configuration steps are the same for all database connectors except the datasource connector.
-
Select the Database connector, for example, JDBC 4 database query. Click Next.
-
Enter the Name, description, event anderror message (if any). Click Next.
-
Select the .jar file of the database driver. Click Next.
-
Enter the Access information. Click Next.
-
Enter the Input query. This is a query to send to the database. You can put single or multiple queries separated by a separator. You can also use the graphical query builder to specify the query. Click Next.
-
Choose how you want to specify the operations on connector outputs. Choose Graphical mode or Scripting mode.
The Graphical mode does not require scripting. Click Next. -
Specify the output operations, using the Graphical mode or using expressions.
-
In the Edit expression window, set the provided variable to get data from the external database.
-
Click Finish.
in the return type, the type of the variable from the database must match the type of variable which is saved to the process variable. |
How to configure a datasource connector
Before you can configure the datasource connector, you need to configure the datasource itself, which is done in the application server.
Follow the instructions in your application server documentation. See here for an example using Tomcat with PostgreSQL.
Configure the connections of the datasource to be created with auto commit set to true.
Make sure that all elements using connections return them to the pool with auto commit still set to true.
A datasource connector can be used in a Database Connection Pool (DBCP). A DBCP is a group of connections. Multiple connections are "reserved" and used as needed.
To configure the datasource connector, you need the following information:
-
The datasource name (for example
java:/comp/env/yourDataSource
). -
Optionally, depending on how the datasource is configured, the properties needed to access it. These are specified as name-value pairs.
To configure the datasource connector, follow these steps:
-
Select the Datasource database query connector. Click Next.
-
Enter the Name, Description, Event and error message (if any). Click Next.
-
Specify the datasource name and, optionally, properties. Click Next.
-
Enter the Input query. This is a query to send to the database. You can put single or multiple queries separated by a separator. You can also use the graphical query builder to specify the query. Click Next.
-
Choose how you want to specify the operations on connector outputs. Choose Graphical mode or Scripting mode. The Graphical mode does not require scripting. Click Next.
-
Specify the output operations, using the Graphical mode or using expressions.
-
In the Edit expression window, set the provided variable to get data from the external database.
-
Click Finish.