Bug #1884 Updatable Result Sets
Submitted: 19 Nov 2003 1:42 Modified: 19 Nov 2003 5:24
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.0.9 Stable OS:Windows (Windows 2k)
Assigned to: CPU Architecture:Any

[19 Nov 2003 1:42] [ name withheld ]
Description:
I'm using MySQL 4.0.15 with Connector/J 3.0.9 stable. I wrote a simple test java program to check if updatable result sets are correctly handled, with creating a CONCUR_UPDATABLE resultset on several tables: call prepareStatement("select * from TABLE", CONCUR_UPDATABLE) and display resultset.getConcurrency()...

However, on some of my tables, the resultset is not updtatable (I have a com.mysql.jdbc.NotUpdatable when i tried to update a row)

I'm suprised because:

1- it only affects some of my tables, but not all of them.
2- the problem vanished with an old version: Connector J 3.0.2 beta, but reappears with 3.0.3 and following versions.

Have you any suggestion ?

Thanks for help,

Arnaud.

How to repeat:
Here's the test case:

Properties namingProps = new Properties();
InitialContext ic = null;

// Init
namingProps.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:900");
namingProps.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");

// Get DataSource
ic = new InitialContext(namingProps);
DataSource datasource = (DataSource) ic.lookup("jdbc/STDDataSource");

// SQL
Connection jdbc = datasource.getConnection();
PreparedStatement ps = jdbc.prepareStatement("SELECT * FROM MENU", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);

ResultSet rs = ps.executeQuery();
System.out.println("" + rs.getConcurrency());
[19 Nov 2003 2:12] [ name withheld ]
I'm really sorry, i just noticed i have not defined primary keys (i thought i had done it) of some of my tables (surprisingly tables who didn't work ;)

How to close the bug ?

Regards, 

Arnaud.