[fix][PES][datasource] fix DB2 schema query to use correct SQL instead of invalid command#983
Open
aiceflower wants to merge 1 commit intodev-2.0.0from
Open
[fix][PES][datasource] fix DB2 schema query to use correct SQL instead of invalid command#983aiceflower wants to merge 1 commit intodev-2.0.0from
aiceflower wants to merge 1 commit intodev-2.0.0from
Conversation
…t SQL instead of invalid command - Fix getAllDatabases() method in DB2 SqlConnection classes - Replace invalid "list database directory" command with proper SQL query - Add configurable schema query SQL with default filtering system schemas - Query SYSCAT.SCHEMATA to get actual schema list from DB2 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR fixes the DB2 schema query issue in the
getAllDatabases()method of DB2 SqlConnection classes. The original implementation used an invalid commandlist database directorywhich is a DB2 CLP command, not a valid SQL statement, causing the schema list retrieval to fail.Changes:
list database directorycommand with proper SQL query againstSYSCAT.SCHEMATAwds.linkis.server.mdm.service.db2.schema.query.sql) with default filtering system schemas (SYS%, NULLID, SQLJ)linkis-datasource-manager/service/jdbc/src/main/java/org/apache/linkis/metadata/query/service/db2/SqlConnection.javalinkis-metadata-query/service/jdbc/src/main/java/org/apache/linkis/metadata/query/service/db2/SqlConnection.javaWhy are the changes needed?
The
list database directorycommand is a DB2 CLP (Command Line Processor) command that cannot be executed via JDBCexecuteQuery(). This causes SQLException when trying to get the schema/database list from DB2 data sources.Brief change log:
getAllDatabases()method to use proper SQL:SELECT SCHEMANAME FROM SYSCAT.SCHEMATA WITH URdataBaseNametoschemaNamesfor clarity (DB2 uses schemas, not databases)How was this patch tested?
Does this PR introduce any user-facing change?
wds.linkis.server.mdm.service.db2.schema.query.sqlif neededCheck List (Author)
[fix][PES][datasource] fix DB2 schema query to use correct SQL instead of invalid command🤖 Generated with Claude Code