SQL Query Tool

The SQL Query Tool enables executing SQL statements on a specified database within Joget DX. It supports both custom and default datasources for flexibility in database connectivity.

Configure SQL Query

To configure SQL Query, drag and drop the Tool element onto the canvas in Process Builder,  click on it, and select Mapping.

When adding SQL Query in the field Tools, you will see the following fields available for configuration:

  • Datasource: Specify the target database to execute SQL statements on.
    • Custom Datasource: Requires JDBC Connection Parameters.
    • Default Datasource: Points to the current database to which your Joget instance is connected.
  • Custom JDBC Driver: Specify the JDBC driver name.
    • com.mysql.jdbc.Driver (MySQL)
    • oracle.jdbc.driver.OracleDriver (Oracle)
    • com.microsoft.sqlserver.jdbc.SQLServerDriver (Microsoft SQL Server)
      This is only applicable to the Custom Datasource option.
  • Custom JDBC URL: Database connection URL, such as jdbc:mysql://localhost:3306/jwdb.
    This is only applicable to the Custom Datasource option.
  • Custom JDBC Username: Database username, such as root
    This is only applicable to the Custom Datasource option.
  • Custom JDBC Password: Specified database user's password.
    This is only applicable to the Custom Datasource option.

Query

The Query field in the SQL Query Tool configuration allows users to input the SQL statements they wish to execute. This field supports hash variables, enabling dynamic query generation based on workflow data. Users can enter various SQL commands, such as SELECT, INSERT, UPDATE, and DELETE, depending on their requirements. It’s important to ensure the SQL syntax is correct and that the commands are appropriate for the target database to avoid errors during execution.

Field to configure: 

  • Query: Enter the SQL statement to execute. Hash variables are accepted here.
    FAQ
    Can I put multiple queries in the query itself?

    It depends on the JDBC driver's capability. Some JDBC drivers may support batch processing or multiple statements separated by semicolons.

Additional resources

Provide links to related articles and documentation that offer further guidance and detailed explanations on using the SQL Query Tool and handling database operations within Joget DX. These resources include topics such as calling stored procedures in MySQL and understanding common JDBC errors. They are valuable for users seeking to deepen their knowledge and troubleshoot issues effectively while working with SQL queries in Joget DX.

Created by Julieth Last modified by Aadrian on Dec 13, 2024