8.  IBM DB2

8.1. Known issues with DB2

Example 2.4.  Example properties for IBM DB2

openjpa.ConnectionDriverName: com.ibm.db2.jcc.DB2Driver
openjpa.ConnectionURL: jdbc:db2://SERVER_NAME:SERVER_PORT/DB_NAME

8.1.  Known issues with DB2

  • Floats and doubles may lose precision when stored.

  • Empty char values are stored as NULL.

  • Fields of type BLOB and CLOB are limited to 1M. This number can be increased by extending DB2Dictionary.

  • Explicit creation of indexes specified by the OpenJPA @Index annotation will fail on DB2 for iSeries if the default schema used by the JDBC driver does not exist. If a default schema is not specified on the connection, the iSeries will default to the user profile name. If a schema of that name does not exist, DB2 on iSeries will not create the schema, resulting in a failure when creating the index. The failure message will look similar to: "[SQL0204] USERNAME in QSYS type *LIB not found." To work around this issue, specify a default schema on the JDBC URL or data source property and make sure that schema exists or create a schema which matches the user profile of the connection.

  • Use of DB2 on z/OS with the IBM JCC driver requires the DESCSTAT subsystem parameter value to be set to 'YES'. If this parameter is set to 'NO', the mapping tool will fail with a persistence exception containing this text: "Invalid parameter: Unknown column name TABLE_SCHEM". After changing the value of DESCSTAT, DB2 metadata tables must be recreated by running the DSNTIJMS job. See DB2 for z/OS documentation for additional information.

  • When using LOBs with persistent attributes of a streaming data type (e.g. java.io.InputStream) in the case of very large LOB, DB2 JCC driver will automatically use progressive streaming to retrieve the LOB data. With progressiveStreaming, the inputStream retrieved must be fully materialized before the next iteration of call to rs.next(). By default this will result in a LobClosedException when OpenJPA processes the InputStream.

    To work around this condition you may force fullyMaterializedLobData to true in the connection URL as shown below :

    openjpa.ConnectionURL: jdbc:db2://localhost:50000/demodb:fullyMaterializeLobData=true;progressiveStreaming=NO