Principle:Apache Dolphinscheduler Query Execution Through Connection
| Knowledge Sources | |
|---|---|
| Domains | Data_Integration, SQL_Processing |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
A SQL execution pipeline that parses multi-statement SQL blocks, removes comments, splits into individual statements, and executes them through pooled database connections.
Description
The Query Execution Through Connection principle defines how DolphinScheduler processes SQL submitted by tasks. Multi-statement SQL blocks are first cleaned using Druid SQLParserUtils.removeComment() to strip comments, then split into individual statements using SQLParserUtils.split(). Each statement is executed individually through a pooled JDBC connection obtained via DataSourceUtils.getConnection(). The DataSourceUtils facade provides a unified API for connection acquisition, driver lookup, and JDBC URL construction.
Usage
This principle applies to all SQL task execution in DolphinScheduler. SQL tasks submit their SQL text through this pipeline for safe parsing and execution.
Theoretical Basis
The query execution follows a Pipeline Pattern:
// SQL processing pipeline
rawSql -> removeComment(sql) // Strip comments (Druid)
-> split(cleanSql) // Split multi-statement (Druid)
-> for each statement:
getConnection(dbType, param) // Obtain pooled connection
execute(statement) // Execute via JDBC