{"record":{"id":"1ae201e46042d210","repo":"apache/seatunnel","slug":"sql-operation-failed-1ae201","errorCode":"SQL_OPERATION_FAILED","errorMessage":"RedshiftJdbcClient init error","messagePattern":"RedshiftJdbcClient init error","errorType":"error_code","errorClass":"S3RedshiftJdbcConnectorException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-s3-redshift/src/main/java/org/apache/seatunnel/connectors/seatunnel/redshift/RedshiftJdbcClient.java","lineNumber":51,"sourceCode":"\n    private static volatile RedshiftJdbcClient INSTANCE = null;\n\n    private final Connection connection;\n\n    public static RedshiftJdbcClient getInstance(ReadonlyConfig config)\n            throws S3RedshiftJdbcConnectorException {\n        if (INSTANCE == null) {\n            synchronized (RedshiftJdbcClient.class) {\n                if (INSTANCE == null) {\n\n                    try {\n                        INSTANCE =\n                                new RedshiftJdbcClient(\n                                        config.get(S3RedshiftSinkOptions.JDBC_URL),\n                                        config.get(S3RedshiftSinkOptions.JDBC_USER),\n                                        config.get(S3RedshiftSinkOptions.JDBC_PASSWORD));\n                    } catch (SQLException | ClassNotFoundException e) {\n                        throw new S3RedshiftJdbcConnectorException(\n                                CommonErrorCodeDeprecated.SQL_OPERATION_FAILED,\n                                \"RedshiftJdbcClient init error\",\n                                e);\n                    }\n                }\n            }\n        }\n        return INSTANCE;\n    }\n\n    private RedshiftJdbcClient(String url, String user, String password)\n            throws SQLException, ClassNotFoundException {\n        Class.forName(\"com.amazon.redshift.jdbc42.Driver\");\n        this.connection = DriverManager.getConnection(url, user, password);\n    }\n\n    public boolean checkTableExists(String tableName) {\n        boolean flag = false;","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-s3-redshift/src/main/java/org/apache/seatunnel/connectors/seatunnel/redshift/RedshiftJdbcClient.java#L33-L69","documentation":"RedshiftJdbcClient.getInstance builds the singleton JDBC connection using url/user/password from the sink config. Any SQLException (connection failure, bad credentials) or ClassNotFoundException (Redshift JDBC driver missing on the classpath) is wrapped as S3RedshiftJdbcConnectorException(SQL_OPERATION_FAILED, \"RedshiftJdbcClient init error\").","triggerScenarios":"Calling getInstance with JDBC_URL unreachable, wrong JDBC_USER/JDBC_PASSWORD, or the Redshift JDBC driver class not found at static-initialization time.","commonSituations":"VPC/security-group blocking the Redshift port, IAM-auth password rotation, missing driver jar in the SeaTunnel plugin directory, or a malformed jdbc:redshift:// URL.","solutions":["Verify jdbc_url, jdbc_user and jdbc_password in the sink config and test connectivity (nc/telnet to the Redshift endpoint:5439)","Ensure the Redshift JDBC driver jar is installed under the connector's plugin directory","Check the cause chain of the exception to distinguish ClassNotFoundException (driver missing) from SQLException (network/auth)"],"exampleFix":"// before\njdbc_url = \"jdbc:redshift://wrong-host:5439/dev\"\n// after\njdbc_url = \"jdbc:redshift://examplecluster.abc123xyz.us-west-2.redshift.amazonaws.com:5439/dev\"","handlingStrategy":"try-catch","validationCode":"// Pre-flight connectivity check before the job\ntry (Connection c = DriverManager.getConnection(jdbcUrl, user, password)) {\n    System.out.println(\"redshift ok\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    RedshiftJdbcClient.getInstance(config);\n} catch (S3RedshiftJdbcConnectorException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof ClassNotFoundException) { /* install driver jar */ }\n    else if (cause instanceof SQLException) { /* check url/credentials/network */ }\n}","preventionTips":["Pre-test the JDBC URL and credentials with a standalone client","Install the Redshift JDBC driver in the plugin directory before deployment","Whitelist SeaTunnel worker IPs in the Redshift security group"],"tags":["jdbc","redshift","connection"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}