Principle:Apache Dolphinscheduler Connection Parameter Definition
| Knowledge Sources | |
|---|---|
| Domains | Data_Integration, Data_Modeling |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
A two-layer parameter abstraction that separates user-facing connection details (DTO) from internal connection parameters, enabling secure serialization, validation, and transport of database credentials.
Description
The Connection Parameter Definition principle establishes two distinct data models for database connections: BaseDataSourceParamDTO (the user-facing Data Transfer Object with fields like host, port, database, userName, password) and BaseConnectionParam (the internal representation with resolved JDBC URL, encoded password, driver class name). This separation allows the API layer to accept human-readable input while the internal layer operates with resolved, validated, security-hardened connection details.
This two-layer approach solves several problems: password encoding at the boundary, JDBC URL construction from individual components, and supporting database-specific additional parameters through the generic other map.
Usage
Use this principle when defining the parameter model for a new datasource plugin. Create a DTO class extending BaseDataSourceParamDTO for API/UI input and a connection param class extending BaseConnectionParam for internal use. The processors createConnectionParams() method bridges the two.
Theoretical Basis
The Connection Parameter Definition applies the Data Transfer Object (DTO) Pattern and Transformation Pattern:
- DTO Layer (BaseDataSourceParamDTO): Designed for API transport with user-friendly field names
- Internal Layer (BaseConnectionParam): Designed for runtime use with resolved JDBC URLs and encoded passwords
- Transformation: The createConnectionParams() method maps DTO fields to internal parameters, applying password encoding and URL construction
// Transformation pseudocode
ConnectionParam transform(BaseDataSourceParamDTO dto):
param.user = dto.userName
param.password = encode(dto.password)
param.jdbcUrl = buildJdbcUrl(dto.host, dto.port, dto.database)
param.driverClassName = getDatasourceDriver()
param.other = dto.other
return param