Bug #16277 ResultSetMetaData .getColumnClassName(...) returns wrong name for for bigint
Submitted: 7 Jan 2006 14:35 Modified: 5 Apr 2006 20:13
Reporter: Risto Virkkala Email Updates:
Status: Closed Impact on me:
Category:Connector / J Severity:S2 (Serious)
Version:3.1.12 OS:
Assigned to: Mark Matthews CPU Architecture:Any

[7 Jan 2006 14:35] Risto Virkkala
ResultSetMetaData.getColumnClassName(int column) returns wrong class name for bigint. Long is returned instead of BigInteger and vice versa.
This is opposite of the behaviour of ResultSet.getObject()

This bug also seems to be in version 5.0.0-beta

How to repeat:
By calling rs.getMetaData().getColumnClassName(1) for column which datatype is bigint

Suggested fix:
In ResultSetMetaData.java negation is missing in if clause:

		case Types.BIGINT:
			if (isUnsigned) {
				return "java.lang.Long"; //$NON-NLS-1$
			return "java.math.BigInteger"; //$NON-NLS-1$

Should be:
			if (!isUnsigned) {
				return "java.lang.Long"; //$NON-NLS-1$
[9 Jan 2006 13:28] Aleksey Kishkin
verified against  jdbc 3.1.12

.Loading JDBC driver 'com.mysql.jdbc.Driver'


Connected to 5.0.17-max
 result types are: java.math.BigInteger and java.lang.Long
Time: 0,607
There was 1 failure:
1) testUnsignedInt(Bug16277)junit.framework.AssertionFailedError: BIGINT must return java.lang.Long
        at Bug16277.testUnsignedInt(Bug16277.java:26)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at Bug16277.main(Bug16277.java:34)

Tests run: 1,  Failures: 1,  Errors: 0
[9 Jan 2006 13:29] Aleksey Kishkin
testcase I used

Attachment: Bug16277.java (text/x-java), 1.07 KiB.

[3 Apr 2006 20:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from: