Skip to main content
VeloDB Cloud 26.x is based on Apache Doris 4.x. See Version Mapping.

IBM Db2 JDBC Catalog

Run catalog SQL with a warehouse SQL user that can manage catalogs and access the source. Ensure network access from the warehouse to metadata, storage, and source endpoints. For connector deployment, host files, JVM settings, or service configuration changes, contact VeloDB Cloud support.

The JDBC Catalog supports connecting to IBM Db2 databases through the standard JDBC interface. This document describes how to configure the IBM Db2 database connection.

For an overview of JDBC Catalog, please refer to: JDBC Catalog Overview

Usage notes​

To connect to an IBM Db2 database, you need:

  • IBM Db2 11.5.x or higher

  • The JDBC driver for the IBM Db2 database, which you can download from the Maven Repository for the latest or specified version of the IBM Db2 driver. It is recommended to use IBM db2 jcc version 11.5.8.0.

  • Network access from the warehouse to the source server, whose default port is 51000.

Connect to IBM Db2​

CREATE CATALOG db2_catalog PROPERTIES (
'type' = 'jdbc',
'user' = 'USERNAME',
'password' = 'PASSWORD',
'jdbc_url' = 'jdbc:db2://host:port/database',
'driver_url' = 'jcc-11.5.8.0.jar',
'driver_class' = 'com.ibm.db2.jcc.DB2Driver'
)

The jdbc_url defines the connection information and parameters to be passed to the IBM Db2 driver. Supported URL parameters can be found in the Db2 JDBC Driver Documentation.

Hierarchical mapping​

When mapping IBM Db2, VeloDB Cloud's Database corresponds to a Schema under the specified DataBase in DB2 (the "database" parameter in jdbc_url). And the Table under VeloDB Cloud's Database corresponds to the Tables under the Schema in DB2. The mapping relationship is as follows:

VeloDB CloudIBM Db2
CatalogDataBase
DatabaseSchema
TableTable

Column type mapping​

IBM Db2 TypeVeloDB Cloud TypeComment
smallintsmallint
intint
bigintbigint
doubledouble
double precisiondouble
floatdouble
realfloat
decimal(P, S)decimal(P, S)
decfloat(P, S)decimal(P, S)
datedate
timestamp(S)datetime(S)
char(N)char(N)
varchar(N)varchar(N)
long varchar(N)varchar(N)
vargraphicstring
long vargraphicstring
timestring
clobstring
xmlstring
BLOBSTRING / VARBINARYSTRING by default; VARBINARY when enable.mapping.varbinary = true. A future release makes the binary mapping unconditional.
otherUNSUPPORTED

Common issues​

  1. When reading IBM Db2 data through JDBC Catalog, an Invalid operation: result set is closed. ERRORCODE=-4470 exception occurs.

    Add connection parameters to the jdbc_url connection string when creating the IBM Db2 Catalog: allowNextOnExhaustedResultSet=1;resultSetHoldability=1;. For example: jdbc:db2://host:port/database:allowNextOnExhaustedResultSet=1;resultSetHoldability=1;.

  2. Caught java.io.CharConversionException

    This issue can indicate a driver character-set problem. Contact VeloDB Cloud support to review the JDBC driver and managed JVM setting -Ddb2.jcc.charsetDecoderEncoder. See the IBM JDBC troubleshooting guidance.