Search before asking
Linkis Component
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
- Configure a DB2 data source in Linkis
- Try to query the database/schema list through the metadata query service
- 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:
- Replace invalid
list database directory command with proper SQL: SELECT SCHEMANAME FROM SYSCAT.SCHEMATA WITH UR
- Add configurable schema query SQL with default filtering system schemas (SYS%, NULLID, SQLJ)
- Both
linkis-datasource-manager/service/jdbc and linkis-metadata-query/service/jdbc modules need to be fixed
Are you willing to submit a PR?
Search before asking
Linkis Component
Description
The
getAllDatabases()method in DB2 SqlConnection classes uses an invalid commandlist database directorywhich 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.SCHEMATAto get the schema list.Steps to reproduce
getAllDatabases()method throws an SQLException becauselist database directoryis not a valid SQL statement for JDBC executionExpected behavior
The method should successfully return a list of schemas from the DB2 database using a proper SQL query against
SYSCAT.SCHEMATA.Your environment
Anything else
The fix involves:
list database directorycommand with proper SQL:SELECT SCHEMANAME FROM SYSCAT.SCHEMATA WITH URlinkis-datasource-manager/service/jdbcandlinkis-metadata-query/service/jdbcmodules need to be fixedAre you willing to submit a PR?