Bug #2607 Driver returns autoincrement for int fields with mysql 4.1
Submitted: 2 Feb 2004 5:10 Modified: 2 Feb 2004 6:55
Reporter: Norbert Zawodsky Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.1.0 OS:Linux (Linux Intel)
Assigned to: Mark Matthews CPU Architecture:Any

[2 Feb 2004 5:10] Norbert Zawodsky
Description:
Hi,

I submitted following bug to OpenOffice:

With MySQl 4.1.0 connected via Connector/J3 3.1.0, the primary key field is
always treated as <AutoField> (auto increment).

I got following answer:

Hi Norbert, 

I can reproduce this issue, however this can't be fixed. 
This is a Connector/J bug.

You can ask the Connector/J driver if a field an autoincrement field (
ResultSetMetaData.isAutoincrement(ColumnID)) and this method return
always true for an int field in a 4.1.0 mysql database.
With a mysql database version 3.23.31 this problem doesn't occurr.

So sorry, we can't fix this issue.

Bye Marc

How to repeat:
I will attach a small .java file
[2 Feb 2004 5:12] Norbert Zawodsky
testcase

Attachment: db_connect.java (application/octet-stream, text), 937 bytes.

[2 Feb 2004 6:55] Mark Matthews
I can't repeat this with MySQL-4.1.1 and the nightly snapshot of Connector/J 3.1 (from http://downloads.mysql.com/snapshots.php) with the following testcase:

 public void testBug2607() throws Exception {
    	try {
    		this.stmt.executeUpdate("DROP TABLE IF EXISTS testBug2607");
    		this.stmt.executeUpdate("CREATE TABLE testBug2607 (field1 INT PRIMARY KEY)");
    		
    		this.rs = this.stmt.executeQuery("SELECT field1 FROM testBug2607");
    		ResultSetMetaData rsmd = this.rs.getMetaData();
    		
    		assertFalse(rsmd.isAutoIncrement(1));
    	} finally {
			this.stmt.executeUpdate("DROP TABLE IF EXISTS testBug2607");
    	}
    }