JDBC - DATA SOURCE
Description
The JDBC data source is designed to retrieve data from a relational database using the Java Database Connectivity (JDBC) API. JDBC provides a standard interface for accessing relational databases, allowing applications to interact with a wide range of database management systems (DBMS) using SQL. This method is particularly useful for accessing and processing data stored in relational databases, enabling applications to perform complex queries, updates, and transactions. The JDBC data source supports various configuration options to customize the data retrieval process, including specifying the JDBC driver class, database URL, username, password, setup SQL statements, and the query to execute.
Config
REQUIRED
Config Parameters
Name | Description |
---|---|
dbDriverClass | The fully qualified class name of the JDBC driver. This is a required parameter. |
dbUrl | The URL of the database to connect to. This is a required parameter. |
dbUsername | The username for authentication with the database. This is a required parameter. |
dbPassword | The password for authentication with the database. This is a required parameter. |
setUpSQL | SQL statements to execute before the query, such as setting session variables or preparing the database state. This is a required parameter. |
query | The SQL query to execute against the database. This is a required parameter. |
Config Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Inline Feed Source
A JDBC can also be used directly inline within a dataFeed
. An inline JDBC source uses the same parameters. The payload for data points is accessed using json list path operators. An example is provided below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
Common Mistakes
- Incorrect JDBC Driver Class: Ensure that the
dbDriverClass
parameter matches the fully qualified class name of the JDBC driver for the database you are connecting to. - Database URL Issues: Verify that the
dbUrl
parameter is correctly formatted and points to the correct database instance. - Authentication Failures: If you encounter authentication issues, check the
dbUsername
anddbPassword
parameters to ensure they are correct and have the necessary permissions to access the database. - SQL Query Errors: If you encounter errors executing the SQL query, ensure that the
query
parameter is correctly formatted and compatible with the database schema.