{"record":{"id":"62dff8f8ee798360","repo":"apache/seatunnel","slug":"the-length-of-clob-type-is-out-of-range-it-wil","errorCode":null,"errorMessage":"The length of clob type {} is out of range, it will be converted to {}({})","messagePattern":"The length of clob type (.+?) is out of range, it will be converted to (.+?)\\((.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/db2/DB2TypeConverter.java","lineNumber":373,"sourceCode":"            case STRING:\n                if (column.getColumnLength() == null || column.getColumnLength() <= 0) {\n                    builder.columnType(String.format(\"%s(%s)\", DB2_VARCHAR, MAX_VARCHAR_LENGTH));\n                    builder.dataType(DB2_VARCHAR);\n                    builder.length(column.getColumnLength());\n                } else if (column.getColumnLength() <= MAX_CHAR_LENGTH) {\n                    builder.columnType(String.format(\"%s(%s)\", DB2_CHAR, column.getColumnLength()));\n                    builder.dataType(DB2_CHAR);\n                    builder.length(column.getColumnLength());\n                } else if (column.getColumnLength() <= MAX_VARCHAR_LENGTH) {\n                    builder.columnType(\n                            String.format(\"%s(%s)\", DB2_VARCHAR, column.getColumnLength()));\n                    builder.dataType(DB2_VARCHAR);\n                    builder.length(column.getColumnLength());\n                } else {\n                    long length = column.getColumnLength();\n                    if (length > MAX_CLOB_LENGTH) {\n                        length = MAX_CLOB_LENGTH;\n                        log.warn(\n                                \"The length of clob type {} is out of range, \"\n                                        + \"it will be converted to {}({})\",\n                                column.getName(),\n                                DB2_CLOB,\n                                length);\n                    }\n                    builder.columnType(String.format(\"%s(%s)\", DB2_CLOB, length));\n                    builder.dataType(DB2_CLOB);\n                    builder.length(length);\n                }\n                break;\n            case DATE:\n                builder.columnType(DB2_DATE);\n                builder.dataType(DB2_DATE);\n                break;\n            case TIME:\n                builder.columnType(DB2_TIME);\n                builder.dataType(DB2_TIME);","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/db2/DB2TypeConverter.java#L355-L391","documentation":"When converting a string/CLOB-typed column back to DB2 DDL, if the declared length exceeds DB2's maximum CLOB size (MAX_CLOB_LENGTH = 2147483647 characters), the converter clamps it to the maximum and logs this warning, emitting CLOB(max). Otherwise DB2 DDL creation would fail with an oversized length.","triggerScenarios":"reconvert processes a StringType column whose getColumnLength() is greater than 2147483647, e.g. sources reporting LONGTEXT with 4GB lengths or unknown lengths mapped to Long.MAX_VALUE.","commonSituations":"Syncing MySQL LONGTEXT into DB2; connectors defaulting unknown string lengths to max long; schema definitions with huge hand-set lengths.","solutions":["Cap the string column length to <= 2147483647 in the source schema","Accept the clamped CLOB(2147483647) and confirm data fits within the limit","If the text actually fits in VARCHAR, map to a VARCHAR(<=32672) to avoid CLOB overhead","Store oversized documents externally and sync only references"],"exampleFix":"// before (source schema)\nStringType(length = 4294967295)\n// after (clamped to DB2 max)\nStringType(length = 2147483647) // CLOB(2147483647)","handlingStrategy":"validation","validationCode":"// before write\nlong len = column.getColumnLength();\nif (len > 2147483647L) {\n    throw new IllegalArgumentException(\"CLOB length \" + len + \" exceeds DB2 max 2147483647 for column \" + column.getName());\n}","typeGuard":"boolean fitsDb2Clob(long length) {\n    return length <= 2147483647L;\n}","tryCatchPattern":null,"preventionTips":["Cap text column lengths at 2GB-1 for DB2 sinks","Use VARCHAR(<=32672) when content is small to avoid CLOB overhead","Avoid Long.MAX_VALUE as a stand-in for unknown string length"],"tags":["jdbc","db2","clob","length-limit"],"backgroundTag":"value-out-of-range","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}