aiceflower opened a new issue, #5408: URL: https://github.com/apache/linkis/issues/5408
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/linkis/issues) and found no similar issues. ### Linkis Component - [ ] linkis-commons - [ ] linkis-computation-governance - [ ] linkis-dist - [ ] linkis-engineconn-plugin - [ ] linkis-extensions - [ ] linkis-orchestrator - [x] linkis-public-enhancements - [ ] linkis-spring-cloud-services - [ ] linkis-web ### Description The `getAllDatabases()` method in DB2 SqlConnection classes uses an invalid command `list database directory` which is a DB2 CLP (Command Line Processor) command, not a valid SQL query. This causes the schema/database list retrieval to fail when connecting to DB2 data sources via JDBC. The method should use a proper SQL query against the DB2 system catalog view `SYSCAT.SCHEMATA` to get the schema list. ### Steps to reproduce 1. Configure a DB2 data source in Linkis 2. Try to query the database/schema list through the metadata query service 3. The `getAllDatabases()` method throws an SQLException because `list database directory` is not a valid SQL statement for JDBC execution ### Expected behavior The method should successfully return a list of schemas from the DB2 database using a proper SQL query against `SYSCAT.SCHEMATA`. ### Your environment - Linkis version used: dev-2.0.0 - DB2 version: Any DB2 version - JDK: 1.8+ ### Anything else The fix involves: 1. Replace invalid `list database directory` command with proper SQL: `SELECT SCHEMANAME FROM SYSCAT.SCHEMATA WITH UR` 2. Add configurable schema query SQL with default filtering system schemas (SYS%, NULLID, SQLJ) 3. Both `linkis-datasource-manager/service/jdbc` and `linkis-metadata-query/service/jdbc` modules need to be fixed ### Are you willing to submit a PR? - [x] Yes I am willing to submit a PR! -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
