diff --git a/docs/sql-data-sources-jdbc.md b/docs/sql-data-sources-jdbc.md index 0c929fece679d..54a8506bff51e 100644 --- a/docs/sql-data-sources-jdbc.md +++ b/docs/sql-data-sources-jdbc.md @@ -1885,3 +1885,109 @@ as the activated JDBC Driver. + +### Mapping Spark SQL Data Types to DB2 + +The below table describes the data type conversions from Spark SQL Data Types to DB2 data types, +when creating, altering, or writing data to a DB2 table using the built-in jdbc data source with +the [IBM Data Server Driver For JDBC and SQLJ](https://mvnrepository.com/artifact/com.ibm.db2/jcc) as the activated JDBC Driver. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Spark SQL Data TypeDB2 Data TypeRemarks
BooleanTypeBOOLEAN
ByteTypeSMALLINT
ShortTypeSMALLINT
IntegerTypeINTEGER
LongTypeBIGINT
FloatTypeREAL
DoubleTypeDOUBLE PRECISION
DecimalType(p, s)DECIMAL(p,s)The maximum value for 'p' is 31 in DB2, while it is 38 in Spark. It might fail when storing DecimalType(p>=32, s) to DB2
DateTypeDATE
TimestampTypeTIMESTAMP
TimestampNTZTypeTIMESTAMP
StringTypeCLOB
BinaryTypeBLOB
CharType(n)CHAR(n)The maximum value for 'n' is 255 in DB2, while it is unlimited in Spark.
VarcharType(n)VARCHAR(n)The maximum value for 'n' is 255 in DB2, while it is unlimited in Spark.
+ +The Spark Catalyst data types below are not supported with suitable DB2 types. + +- DayTimeIntervalType +- YearMonthIntervalType +- CalendarIntervalType +- ArrayType +- MapType +- StructType +- UserDefinedType +- NullType +- ObjectType +- VariantType