{"record":{"id":"6f9bc675fa27617a","repo":"testcontainers/testcontainers-java","slug":"getparentlogger-not-supported","errorCode":null,"errorMessage":"getParentLogger not supported","messagePattern":"getParentLogger not supported","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"info","filePath":"modules/jdbc/src/main/java/org/testcontainers/jdbc/ContainerDatabaseDriver.java","lineNumber":288,"sourceCode":"        return delegate != null ? delegate.getMajorVersion() : 1;\n    }\n\n    @Override\n    public int getMinorVersion() {\n        return delegate != null ? delegate.getMinorVersion() : 0;\n    }\n\n    @Override\n    public boolean jdbcCompliant() {\n        return delegate != null && delegate.jdbcCompliant();\n    }\n\n    @Override\n    public Logger getParentLogger() throws SQLFeatureNotSupportedException {\n        if (delegate != null) {\n            return delegate.getParentLogger();\n        }\n        throw new SQLFeatureNotSupportedException(\"getParentLogger not supported\");\n    }\n\n    /**\n     * Utility method to kill ALL database containers directly from test support code. It shouldn't be necessary to use this,\n     * but it is provided for convenience - e.g. for situations where many different database containers are being\n     * tested and cleanup is needed to limit resource usage.\n     */\n    public static void killContainers() {\n        synchronized (jdbcUrlContainerCache) {\n            jdbcUrlContainerCache.values().forEach(JdbcDatabaseContainer::stop);\n            jdbcUrlContainerCache.clear();\n            containerConnections.clear();\n            initializedContainers.clear();\n        }\n    }\n\n    /**\n     * Utility method to kill a database container directly from test support code. It shouldn't be necessary to use this,","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/jdbc/src/main/java/org/testcontainers/jdbc/ContainerDatabaseDriver.java#L270-L306","documentation":"The JDBC proxy driver's getParentLogger returns the delegate driver's parent logger when a real container-backed driver is active; otherwise it throws SQLFeatureNotSupportedException because the proxy itself has no underlying driver to delegate to. This mirrors the JDBC optional-API semantics.","triggerScenarios":"Calling Driver.getParentLogger() on a ContainerDatabaseDriver instance before any jdbc:tc connection was established (delegate == null), e.g. using the driver standalone rather than through a container connection.","commonSituations":"Driver-management/monitoring tools enumerating all registered drivers and calling getParentLogger on each; obtaining the driver via new ContainerDatabaseDriver() instead of via a jdbc:tc connection.","solutions":["Only call getParentLogger after establishing a jdbc:tc connection so the delegate driver exists","Guard the call site for SQLFeatureNotSupportedException (an allowed outcome per JDBC spec)","Get the parent logger from the underlying vendor driver directly if needed"],"exampleFix":"// before\nLogger l = new ContainerDatabaseDriver().getParentLogger();\n// after\nLogger l;\ntry {\n    l = driver.getParentLogger();\n} catch (SQLFeatureNotSupportedException e) {\n    l = null; // no delegate driver active\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Logger l;\ntry {\n    l = driver.getParentLogger();\n} catch (java.sql.SQLFeatureNotSupportedException e) {\n    l = null; // no delegate active; acceptable per JDBC spec\n}","preventionTips":["Establish a jdbc:tc connection before querying driver metadata","Treat SQLFeatureNotSupportedException as expected for proxy drivers","Skip getParentLogger in tooling that iterates all registered drivers"],"tags":["jdbc","testcontainers","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}