DB2 - Problembeschreibung
Problem IC65277 | Status: Geschlossen |
USING THE JCC DRIVER, GETTIMESTAMP METHODS OF RESULTSET RETURN A SUBCLASS OF JAVA.SQL.TIMESTAMP | |
Produkt: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problembeschreibung: | |
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 ); } } } | |
Problem-Zusammenfassung: | |
**************************************************************** * USERS AFFECTED: * * Users of the IBM Data Server Driver for JDBC and SQLJ (also * * called the JCC driver) * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * . * **************************************************************** | |
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. | |
verfügbare FixPacks: | |
DB2 Version 9.7 Fix Pack 2 for Linux, UNIX, and Windows | |
Lösung | |
Problem was first fixed in Version 9.7 Fix Pack 2 | |
Workaround | |
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. | |
Weitere Daten | |
Datum - Problem gemeldet : Datum - Problem geschlossen : Datum - der letzten Änderung: | 22.12.2009 02.02.2011 02.02.2011 |
Problem behoben ab folgender Versionen (IBM BugInfos) | |
9.7.FP2 | |
Problem behoben lt. FixList in der Version | |
9.7.0.2 |