JDBC
JDBC (Java Database Connectivity) allows you to connect a variety of databases to DronaHQ through a standardized API. This guide will help you configure the JDBC connector, set up your connection string, and manage connection settings effectively.
Prerequisite
- Authentication Credentials: Ensure you have the necessary credentials (username/password) or access via Secrets Manager Enterprise.
- Connection Details:
- JDBC Driver (e.g.,
com.facebook.presto.jdbc.PrestoDriver
). - Connection String (format:
jdbc:db://host:port
).
- JDBC Driver (e.g.,
Configuring Connector in DronaHQ
Configure your database category by providing below details. Validate the connection with Test connection
and Save
settings for secure and efficient database
setup.
DronaHQ can Auto fill crucial connection values like host, name, password, and more from a AWS IAM credentials using AWS Import. Additionally, with Secrets Manager Enterprise, users can select a vault, and for KV-type vaults, fields are auto-populated with key values.
General
Field | Description |
---|---|
JDBC Driver | Select the JDBC driver from the dropdown - com.facebook.presto.jdbc.PrestoDriver , com.ibm.db2.jcc.DB2Driver , com.ingres.jdbc.IngresDriver , io.trino.jdbc.TrinoDriver , com.teradata.jdbc.TeraDriver |
Connection String | Enter the JDBC connection string in the format jdbc:db://host:port . |
Admin
Advanced Option | Description |
---|---|
Connection Options | The key and value connection options in database configuration refer to specific settings (keys) and their corresponding values that dictate how the application connects to the database |
Whitelist IP | Enhance security by restricting database access to specific whitelisted IP addresses. |
Adding Database Queries
After configuring the connector, access it in your Connector Library. To add queries, click Add query
once the
connection is ready. Create simple or complex queries, view tables and fields. Input Query name, run the query, and see
results in Response.
Use double curly brackets for dynamic variables. Test with sample values before saving. Link dynamic variables to controls/actions and more for runtime use.
Selecting Data
let's see to fetch data using SQL queries
Use the SQL editor to write your query. For example, if you want to fetch all students from a table, use:
SELECT * FROM student;
- Name your query (e.g.,
GetStudents
) to make it easier to identify later. - Run the query by clicking Test Query. The results will appear in the Response tab, showing you what data is returned.
Use Dynamic Filters
- To make your query dynamic, use variables in your SQL. For example, if you want to fetch data for a specific student ID, your query can look like this:
SELECT * FROM student WHERE STUDENT_ID = {{studentId}};
- Here,
{{studentId}}
is a dynamic variable that will be replaced with an actual value at runtime.