IBM Support

IC65277: USING THE JCC DRIVER, GETTIMESTAMP METHODS OF RESULTSET RETURN A SUBCLASS OF JAVA.SQL.TIMESTAMP

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as new function.

Error description

  • Users affected:
    Users of the IBM Data Server Driver for JDBC and SQLJ
    
    
    Problem Description:
    All connectivity types:  The IBM Data Server Driver for JDBC and
    SQLJ released with DB2 for Linux, Unix, and Windows 9.7 Fixpack
    1 returns a subclass of java.sql.Timestamp instead of
    java.sql.Timestamp for ResultSet.getTimestamp(int) or
    ResultSet.getTimestamp(String).  This is perfectly normal and
    allowed by both Java and JDBC.  ResultSet.getTimestamp(int,
    Calendar) and ResultSet.getTimestamp(String, Calendar) has done
    this in DB2 for Linux Unix and Windows 9.1 Fixpack releases.
    
    However, this change has caused a problem in a customer's
    application which depended on the name of the actual underlying
    class. This APAR provides an interim fix for the application's
    problem by returning java.sql.Timestamp instead of a subclass
    when ResultSet.getTimestamp(int) or
    ResultSet.getTimestamp(String) is called.
    
    
    Problem Summary:
    Unless you have this APAR change,
    if your application calls the getClass method on what is
    returned from a getTimestamp method, the getClass method will
    not necessarily return "java.sql.Timestamp"
    (but return the name of the subclass instead).
    
    Here is an example of a program whose behaviour depends on
    the class name that is returned by getTimestamp:
    
    import java.sql.*;
    
    public class IC65277
    {
        public static void main( String arg[] )
        {
            final String url = "<url>";
            final String username = "<username>";
            final String password = "<password>";
    
            try
            {
                Class.forName("com.ibm.db2.jcc.DB2Driver");
                Connection con = DriverManager.getConnection(url,
    username, password);
    
                Statement stmt = con.createStatement();
                String query = "select current timestamp from
    sysibm.sysdummy1";
                PreparedStatement pQuery =
    con.prepareStatement(query);
                ResultSet rs = pQuery.executeQuery();
    
                while (rs.next())
                {
                    Object value = rs.getTimestamp(1);
                    System.out.println(" Class  = " +
    value.getClass());
                    System.out.println(" Result = " + value );
                }
            }
            catch( Exception e )
            {
            System.err.println( e );
            }
        }
    }
    

Local fix

  • The subclass of java.sql.Timestamp that is returned from
    getTimestamp can be used with any APIs that normally operate on
    a java.sql.Timestamp.
    So applications which call getTimestamp should normally need no
    change.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * Users of the IBM Data Server Driver for JDBC and SQLJ (also  *
    * called the JCC driver)                                       *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * .                                                            *
    ****************************************************************
    

Problem conclusion

  • Problem was first fixed in Version 9.7 Fix Pack 2
    

Temporary fix

  • The subclass of java.sql.Timestamp that is returned from
    getTimestamp can be used with any APIs that normally operate on
    a java.sql.Timestamp.
    So applications which call getTimestamp should normally need no
    change.
    

Comments

APAR Information

  • APAR number

    IC65277

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    970

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2009-12-22

  • Closed date

    2011-02-02

  • Last modified date

    2011-02-02

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • R970 PSN

       UP

[{"Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU053","label":"Cloud \u0026 Data Platform"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.7"}]

Document Information

Modified date:
16 September 2021