{"record":{"id":"069c0916917919e6","repo":"pentaho/pentaho-kettle","slug":"the-invalidatenameddatasource-method-was-not-implemented-yet","errorCode":null,"errorMessage":"The invalidateNamedDataSource method was not implemented yet.","messagePattern":"The invalidateNamedDataSource method was not implemented yet\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/DataSourceProviderInterface.java","lineNumber":66,"sourceCode":"   * @param dbMeta  definition of the datasource provided via DatabaseMeta\n   * @param type    data source's type\n   * @return named data source\n   * @throws DataSourceNamingException\n   */\n  default DataSource getPooledDataSourceFromMeta( DatabaseMeta dbMeta, DatasourceType type ) throws DataSourceNamingException {\n    throw new UnsupportedOperationException( \"getNamedDataSourceFromMeta is not supported\" );\n  }\n\n  /**\n   * Invalidate the named data source of respecting its <code>type</code>\n   *\n   * @param datasourceName name of the desired data source\n   * @param type           data source's type\n   * @return named data source\n   * @throws DataSourceNamingException\n   */\n  default DataSource invalidateNamedDataSource( String datasourceName, DatasourceType type ) throws DataSourceNamingException {\n    throw new UnsupportedOperationException( \"The invalidateNamedDataSource method was not implemented yet.\" );\n  }\n\n  enum DatasourceType {\n    JNDI, POOLED\n  }\n}\n","sourceCodeStart":48,"sourceCodeEnd":73,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/DataSourceProviderInterface.java#L48-L73","documentation":"invalidateNamedDataSource is a default method on DataSourceProviderInterface whose default body throws UnsupportedOperationException stating it was not implemented yet. Providers must override it to support invalidating (closing/refreshing) named data sources. getPoolingDataSource in Database.java calls it.","triggerScenarios":"Calling invalidateNamedDataSource(datasourceName, type) directly, or indirectly through Database.getPoolingDataSource, when the DataSourceProviderInterface implementation has not overridden the method.","commonSituations":"Using pooled database connections with a minimal custom data source provider; library upgrade added the interface method but the provider was never updated to implement it.","solutions":["Override invalidateNamedDataSource in your DataSourceProviderInterface implementation","Avoid the pooling code path (disable connection pool on the DatabaseMeta) if invalidation is not needed","Catch UnsupportedOperationException and treat invalidation as a no-op if acceptable"],"exampleFix":"// before\npublic DataSource invalidateNamedDataSource( String name, DatasourceType type ) {\n  throw new UnsupportedOperationException( \"not implemented\" );\n}\n\n// after\n@Override\npublic DataSource invalidateNamedDataSource( String name, DatasourceType type ) {\n  pool.evict( name );\n  return pool.refresh( name );\n}","handlingStrategy":"try-catch","validationCode":"if ( !dbMeta.isUsingConnectionPool() ) {\n  // skip code path that calls invalidateNamedDataSource\n}","typeGuard":"boolean supportsInvalidate = !DataSourceProviderInterface.class.equals(\n  dsp.getClass().getMethod( \"invalidateNamedDataSource\", String.class, DatasourceType.class ).getDeclaringClass() );","tryCatchPattern":"try {\n  dsp.invalidateNamedDataSource( name, type );\n} catch ( UnsupportedOperationException e ) {\n  log.warn( \"Provider does not support invalidation; skipping\" );\n}","preventionTips":["Implement invalidateNamedDataSource whenever you implement the provider interface","Disable connection pool option if your provider cannot invalidate sources","Track interface changes when upgrading Pentaho versions"],"tags":["unsupported-operation","method-not-implemented","connection-pool"],"backgroundTag":"method-not-implemented","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}