Bug #8239 DatabaseMetaData.supportsResultSetType(ResultSet.CONCUR_UPDATABLE)) return fals
Submitted: 1 Feb 2005 15:25 Modified: 1 Feb 2005 15:58
Reporter: Paul van Rossem Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.1.6 OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[1 Feb 2005 15:25] Paul van Rossem
Description:
DatabaseMetaData.supportsResultSetType(ResultSet.CONCUR_UPDATABLE)) returns false when it should return true.
Using Windows XP Home, MySQL Server 5.0.2A, Connector/J 3.1.6, JDK 1.5.0_01.
(table has primary key column)

How to repeat:
Schema: CREATE TABLE MyTable(RowID SMALLINT NOT NULL PRIMARY KEY,
                                         ColumnName VARCHAR(32) UNIQUE);
Test:
public class TestApp 
{  public static void main(String args[]) 
   {  Connection con; 
       try 
       {  Class.forName("com.mysql.jdbc.Driver"); 
           con = DriverManager.getConnection("jdbc:mysql://localhost/test",
                                                             "user", "secret");
           System.out.println("updatable = " + 
                  con.getMetaData().supportsResultSetType(
                             ResultSet.CONCUR_UPDATABLE));   // reports 'false'
           Statement stmt =  con.createStatement();
           ResultSet rs = stmt.executeQuery("SELECT * FROM MyTable");
           rs.first();
           rs.updateString("ColumnName", "NewValue");
           rs.updateRow();   // succeeds!
       } 
        catch(Exception exc) 
       {  System.out.println("Exception: " + exc.getMessage()); 
       }
    }
}
[1 Feb 2005 15:58] Mark Matthews
This isn't a bug, except for the fact that we should perhaps throw an exception when you pass in a _concurrency_ and not a _type_. Types for this method are java.sql.ResultSet.TYPE_SCROLL_SENSITIVE and java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE.

If you want to check concurrency, you need to use the DatabaseMetadata method supportsResultSetConcurrency(int, int).