You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@linkis.apache.org by "aiceflower (via GitHub)" <gi...@apache.org> on 2026/04/12 14:44:53 UTC
[PR] [fix][EC][jdbc] Add configurable validation query for different database types [linkis]
aiceflower opened a new pull request, #5412:
URL: https://github.com/apache/linkis/pull/5412
### What changes were proposed in this pull request?
This PR adds configurable validation query support for JDBC engine connection pool, enabling proper connection validation for Oracle, DB2, and other databases that require non-standard validation queries.
Changes:
1. **ConnectionManager.java**: Added validation query mapping logic that auto-detects database type from JDBC URL and selects appropriate validation query
2. **JDBCEngineConnConstant.java**: Added new configuration constant for validation query mapping
3. **JDBCConfiguration.scala**: Added configuration item with default support for Oracle and DB2
4. **distribution.xml**: Excluded conflicting jars from JDBC plugin assembly packaging
### Why are the changes needed?
JDBC engine connection pool uses "SELECT 1" as the default validation query, which works for MySQL and PostgreSQL but fails for:
- Oracle: requires "SELECT 1 FROM DUAL"
- DB2: requires "SELECT 1 FROM SYSIBM.SYSDUMMY1"
Fixes #5411
### How was this patch tested?
- [ ] Oracle database connection pool validation test
- [ ] DB2 database connection pool validation test
- [ ] MySQL/PostgreSQL default validation query compatibility test
- [ ] JDBC plugin assembly packaging test (no jar conflicts)
### Does this PR introduce any user-facing change?
Yes, users can now configure database-specific validation queries via:
```properties
# Format: dbType1:query1,dbType2:query2,...
wds.linkis.jdbc.validation.query.mapping=oracle:SELECT 1 FROM DUAL,db2:SELECT 1 FROM SYSIBM.SYSDUMMY1
```
### How was this patch tested?
- Verified connection pool initialization with Oracle JDBC URL
- Verified connection pool initialization with DB2 JDBC URL
- Verified backward compatibility with MySQL/PostgreSQL
### Check List
- [x] Update License info if needed
- [ ] Add new UT/IT if needed
- [ ] Need to update docs
- [ ] Need to add warning banner in README
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@linkis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@linkis.apache.org
For additional commands, e-mail: dev-help@linkis.apache.org
Re: [PR] [fix][EC][jdbc] Add configurable validation query for different database types [linkis]
Posted by "casionone (via GitHub)" <gi...@apache.org>.
casionone merged PR #5412:
URL: https://github.com/apache/linkis/pull/5412
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@linkis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@linkis.apache.org
For additional commands, e-mail: dev-help@linkis.apache.org