| Bug #7647 | ResultSet.getObject returns BigInteger for SMALLINT column; rather than Integer | ||
|---|---|---|---|
| Submitted: | 3 Jan 2005 23:06 | Modified: | 5 Apr 2005 7:56 |
| Reporter: | Kevin Grittner | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MaxDB | Severity: | S2 (Serious) |
| Version: | 7.4.3 through 7.6.00.00.3247 | OS: | Any (any) |
| Assigned to: | Ulf Wendel | CPU Architecture: | Any |
[5 Jan 2005 20:54]
Ulf Wendel
Kevin, this is an excellent bug report. I've verified the bug and I'll keep you informed about the progress. Regards, Ulf Wendel
[6 Jan 2005 10:36]
Ulf Wendel
Hello Kevin, one of the developers has made an offer which we usually don't make. We can provide you with a pre-release version of the next version of the JDBC driver for testing. Are you interested? Regards, Ulf
[6 Jan 2005 12:29]
Ulf Wendel
Hello Kevin, the developers have created an entry on the PTS (problem tracking system). Feel free to track the progress yourself on http://sapdb.org/webpts (Advanced Search => Number => 1133264) once the web database has been synchronized with the internal system. Regards, Ulf
[5 Apr 2005 7:56]
Ulf Wendel
Fixed in 7.5.00.24 - thanks for reporting!

Description: Retrieving an object from the ResultSet.getObject method, where the type of the column is SMALLINT, yields a java.math.BigDecimal object. According to the JDBC 3.0 Specification (table B-3 in appendix B), it should return a java.lang.Integer object. How to repeat: statement.executeUpdate("CREATE TABLE TESTSMALLINT (F1 SMALLINT)"); statement.executeUpdate("INSERT INTO TESTSMALLINT VALUES (1)"); ResultSet rs = statement.executeQuery("SELECT * FROM TESTSMALLINT"); rs.next(); Object obj = rs.getObject(1); System.out.println(obj.getClass().getName()); Should print: java.lang.Integer Is printing: java.math.BigDecimal Suggested fix: com.sap.dbtech.jdbc.translators.NumericTranslator.getObject should be modified to insert the second of the following lines among the other (existing) lines: case DataType.Dinteger: case DataType.Dsmallint: return new Integer(this.getInt(controller, mem)); // isnull catched before default: return this.getBigDecimal (controller, mem);