Database SQL Query List Data Store
The Database SQL Query List Data Store in Joget allows the creation of custom lists using user-defined SQL queries and database connections. This feature provides flexibility in designing lists by leveraging SQL queries to fetch data from either the Joget or an external database.
Configure database SQL Query
To set up an external directory, go to Data, then select Data Store.
Fields to Configure:
- Select Source of Data (Data Store): Choose Database SQL Query List Data Store.
Ensure your Joget environment is configured to use LDAP/AD in the Directory Manager Settings.
- Datasource: Target database to execute SQL statements on.
- Custom Datasource: Requires JDBC Connection Parameters.
- Default Datasource: Points to the current database your Joget instance connects to.
- Custom JDBC Driver: JDBC driver name
Example values:com.mysql.jdbc.Driver
(MySQL)oracle.jdbc.driver.OracleDriver
(Oracle)com.microsoft.sqlserver.jdbc.SQLServerDriver
(Microsoft SQL Server)
- Custom JDBC URL: Database connection URL (e.g.,
jdbc:mysql://localhost:3306/jwdb
). - Custom JDBC Username: Database username (e.g.,
root
). - Custom JDBC Password: Specified database user's password.
- SQL SELECT Query: SQL Select query to populate the datalist. (e.g.,
SELECT * FROM app_fd_myTable
).
Table & Column Naming
-
- For database tables created by Joget Forms, Joget adds a
c_
in front of table column names (ort_
if your column name starts with a number) andapp_fd_
in front of database table names. - If you use environment hash variables to store SQL query strings, use
?noescape
to escape SQL query strings in JDBC binders to prevent the<>
(not equal) the operator from being converted, i.e., disables XSS prevention checking. For more information, see Escaping the Resultant Hash Variable.
- For database tables created by Joget Forms, Joget adds a
-
- Primary Key: Define the primary key column. By default, it should be
id
. - Optimize query for paging: When checked, the data store only fetches selected page's items to optimize performance for large dataset paging.
Additional resources
Explore more about SQL queries with Joget through these resources: