{"record":{"id":"f124e72bb92e57d4","repo":"apache/seatunnel","slug":"create-driver-failed-f124e7","errorCode":"CREATE_DRIVER_FAILED","errorMessage":"unable to open JDBC writer","messagePattern":"unable to open JDBC writer","errorType":"error_code","errorClass":"JdbcConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/executor/CopyManagerBatchStatementExecutor.java","lineNumber":66,"sourceCode":"    CopyManagerProxy copyManagerProxy;\n    CSVFormat csvFormat = CSVFormat.POSTGRESQL_CSV;\n    CSVPrinter csvPrinter;\n\n    public CopyManagerBatchStatementExecutor(String copySql, TableSchema tableSchema) {\n        this.copySql = copySql;\n        this.tableSchema = tableSchema;\n    }\n\n    public static void copyManagerProxyChecked(JdbcConnectionProvider connectionProvider) {\n        try (Connection connection = connectionProvider.getConnection()) {\n            new CopyManagerProxy(connection);\n        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {\n            throw new JdbcConnectorException(\n                    JdbcConnectorErrorCode.NO_SUPPORT_OPERATION_FAILED,\n                    \"unable to open CopyManager Operation in this JDBC writer. Please configure option use_copy_statement = false.\",\n                    e);\n        } catch (SQLException e) {\n            throw new JdbcConnectorException(\n                    JdbcConnectorErrorCode.CREATE_DRIVER_FAILED, \"unable to open JDBC writer\", e);\n        }\n    }\n\n    @Override\n    public void prepareStatements(Connection connection) throws SQLException {\n        try {\n            this.copyManagerProxy = new CopyManagerProxy(connection);\n            this.csvPrinter = new CSVPrinter(new StringBuilder(), csvFormat);\n        } catch (NoSuchMethodException\n                | IllegalAccessException\n                | InvocationTargetException\n                | IOException e) {\n            throw new JdbcConnectorException(\n                    JdbcConnectorErrorCode.NO_SUPPORT_OPERATION_FAILED,\n                    \"unable to open CopyManager Operation in this JDBC writer. Please configure option use_copy_statement = false.\",\n                    e);\n        } catch (SQLException e) {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/executor/CopyManagerBatchStatementExecutor.java#L48-L84","documentation":"In copyManagerProxyChecked(), if the probe connection itself throws SQLException (cannot get/open a connection to run the COPY probe), the error is wrapped as CREATE_DRIVER_FAILED with message 'unable to open JDBC writer'. It signals the JDBC writer could not establish the driver connection needed for COPY.","triggerScenarios":"use_copy_statement=true sink initialization when connectionProvider.getConnection() fails — bad URL, unreachable host, wrong credentials, driver not registered, or connection pool exhausted.","commonSituations":"Network/firewall blocking the DB port; expired or wrong password; driver jar missing from the plugin lib directory so no suitable driver is found.","solutions":["Check connectivity to the database (host, port, firewall, pg_hba.conf rules)","Validate url/user/password in the JDBC sink options by connecting with psql or another client","Ensure the correct JDBC driver jar is present in the SeaTunnel connector lib directory","Review the caused-by chain of this exception for the underlying driver error"],"exampleFix":"// before\nurl = \"jdbc:postgresql://wrong-host:5432/db\"\n// after\nurl = \"jdbc:postgresql://db-host:5432/db\"  // verify with: psql 'postgresql://db-host:5432/db'","handlingStrategy":"retry","validationCode":"// before job submission\ntry (Connection c = DriverManager.getConnection(url, user, pass)) {\n    c.isValid(5);\n}","typeGuard":null,"tryCatchPattern":"try {\n    CopyManagerBatchStatementExecutor.copyManagerProxyChecked(provider);\n} catch (JdbcConnectorException e) {\n    if (JdbcConnectorErrorCode.CREATE_DRIVER_FAILED.equals(e.getErrorCode())) {\n        retryWithBackoff(() -> copyManagerProxyChecked(provider)); // transient connectivity\n    } else throw e;\n}","preventionTips":["Validate DB reachability (host/port/credentials) before job submission","Keep driver jars in the plugin lib directory and avoid duplicate conflicting versions","Monitor database max_connections and pool settings"],"tags":["jdbc","connection","driver","copy"],"backgroundTag":"connection-refused","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}