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 Type | +DB2 Data Type | +Remarks | +
---|---|---|
BooleanType | +BOOLEAN | ++ |
ByteType | +SMALLINT | ++ |
ShortType | +SMALLINT | ++ |
IntegerType | +INTEGER | ++ |
LongType | +BIGINT | ++ |
FloatType | +REAL | ++ |
DoubleType | +DOUBLE 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 | +
DateType | +DATE | ++ |
TimestampType | +TIMESTAMP | ++ |
TimestampNTZType | +TIMESTAMP | ++ |
StringType | +CLOB | ++ |
BinaryType | +BLOB | ++ |
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. | +