Date/time types, SQL, and the debugger

The debugger uses the sqlDataCode property in some cases to determine the format for date/time types.

If you migrated from IBM®VisualAge® Generator, you might define date, time, and timestamp columns from an SQL database as CHAR data in the corresponding EGL Record definitions. You can also set your preferences so that Records that EGL creates through the Data Access Application wizard or the SQL retrieve feature use a character type (CHAR, UNICODE, or STRING) for date/time data. These character fields that EGL creates can optionally include the sqlDataCode property, which preserves the column type from a DB2® SQL table.

The following table shows how the EGL debugger determines the proper formatting for date/time data.

Table 1. Formatting for date/time data
Data type Formatting
EGL DATE, TIME, or TIMESTAMP The value is passed between EGL and the database as a JDBC Date, Time, or Timestamp object. Neither EGL nor the JDBC driver needs to format the data.
character field with sqlDataCode property The appropriate strLib.defaultDateFormat, defaultTimeFormat, or defaultTimeStampFormat system variable determines the format when the data is retrieved or written to the database. For the debugger, the initial values for these variables come from the debug build descriptor.
character field without sqlDataCode property EGL does not format anything and uses whatever data is passed back and forth by the JDBC driver.
When using the DB2 JDBC Universal Driver, you can control the format of the data that is passed by the JDBC driver through the properties of the connection URL that you specify in your debug sqlDB build descriptor. The following properties are available:

For the possible values of n, see your DB2 documentation.

If you use a driver other than the DB2 JDBC Universal Driver, refer to your driver documentation for possible equivalents.

Example

The following example shows a connection URL assigned to the sqlDB build descriptor. Be sure to distinguish between colons and semicolons.
jdbc:db2://ctfmvs07.rtp.raleigh.ibm.com:9070/NQA17D03:retrieveMessagesFromServerOnGetMessage=true;dateFormat=2;timestampFormat=1;timestampPrecisionReporting=2;

Feedback