{"record":{"id":"18e3ae06640aea6f","repo":"Activiti/Activiti","slug":"couldn-t-get-activiti-table-names-using-metadata","errorCode":null,"errorMessage":"couldn't get activiti table names using metadata: ${e.getMessage()}","messagePattern":"couldn't get activiti table names using metadata: (.+?)","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/TableDataManagerImpl.java","lineNumber":206,"sourceCode":"                }\n\n                tables = databaseMetaData.getTables(\n                    catalog,\n                    schema,\n                    tableNameFilter,\n                    DbSqlSession.JDBC_METADATA_TABLE_TYPES\n                );\n                while (tables.next()) {\n                    String tableName = tables.getString(\"TABLE_NAME\");\n                    tableName = tableName.toUpperCase();\n                    tableNames.add(tableName);\n                    log.debug(\"  retrieved activiti table name {}\", tableName);\n                }\n            } finally {\n                tables.close();\n            }\n        } catch (Exception e) {\n            throw new ActivitiException(\"couldn't get activiti table names using metadata: \" + e.getMessage(), e);\n        }\n        return tableNames;\n    }\n\n    protected long getTableCount(String tableName) {\n        log.debug(\"selecting table count for {}\", tableName);\n        Long count = (Long) getDbSqlSession().selectOne(\"selectTableCount\", singletonMap(\"tableName\", tableName));\n        return count;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public TablePage getTablePage(TablePageQueryImpl tablePageQuery, int firstResult, int maxResults) {\n        TablePage tablePage = new TablePage();\n\n        @SuppressWarnings(\"rawtypes\")\n        List tableData = getDbSqlSession()\n            .getSqlSession()","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/TableDataManagerImpl.java#L188-L224","documentation":"Activiti wraps any Exception raised while reading JDBC DatabaseMetaData to list the tables owned by the engine into this ActivitiException. The engine calls DatabaseMetaData.getTables() during schema check/creation (e.g. databaseSchemaUpdate=true) and cannot recover if the metadata query fails. The original exception is chained as the cause.","triggerScenarios":"Calling getTablesPresentInDatabase() (directly or via getTableCount / schema operations like ProcessEngine configuration with databaseSchemaUpdate) when the JDBC connection is broken, the database user lacks metadata privileges, or the catalog/schemaFilter configured does not match the database.","commonSituations":"Wrong databaseSchema/catalog settings in the datasource config; DB user without SELECT on metadata tables; connection dropped between pool checkout and metadata call; unsupported JDBC driver returning errors from getTables().","solutions":["Check the chained cause (e.getCause()) to see the real JDBC error and fix the underlying connection or privilege problem","Verify databaseSchema/databaseCatalog/tablePrefix configuration matches your database","Grant the DB user metadata read privileges (e.g. SELECT on information_schema or system catalog views)","Test the datasource connection with a simple query before starting the engine"],"exampleFix":"// before\n<property name=\"databaseSchemaUpdate\" value=\"true\"/>\n// after\n<!-- validate schema first with correct user privileges -->\n<property name=\"databaseSchemaUpdate\" value=\"false\"/>\n<property name=\"databaseSchema\" value=\"ACT\"/>","handlingStrategy":"try-catch","validationCode":"// before engine startup\ntry (Connection c = dataSource.getConnection()) {\n    DatabaseMetaData md = c.getMetaData();\n    try (ResultSet rs = md.getTables(null, null, \"ACT_%\", new String[]{\"TABLE\"})) {\n        if (!rs.isBeforeFirst()) throw new IllegalStateException(\"no metadata access\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    tableNames = tableDataManager.getTablesPresentInDatabase();\n} catch (ActivitiException e) {\n    logger.error(\"table metadata lookup failed\", e.getCause());\n    throw new ConfigurationException(\"fix DB metadata access\", e);\n}","preventionTips":["Verify DB user has catalog/metadata read privileges before startup","Set databaseSchema/catalog correctly for your database","Keep JDBC driver versions current","Set databaseSchemaUpdate=false in production after initial schema creation"],"tags":["database","jdbc","metadata","schema"],"backgroundTag":"database-query-failed","analyzedSha":"56435b1a97deeafdc09dd40074b056c89fba5a8a","analyzedAt":"2026-09-09T21:00:06.703Z","contentChangedAt":"2026-09-09T21:00:06.703Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}