Bug #6213 Connector/J Result.getConcurrency() doesn't return the right value
Submitted: 22 Oct 2004 12:34 Modified: 27 Oct 2004 8:16
Reporter: Christophe JOLIF Email Updates:
Status: Not a Bug Impact on me:
Category:Connector / J Severity:S1 (Critical)
Version:3.0.15-ga OS:Windows (XP)
Assigned to: CPU Architecture:Any

[22 Oct 2004 12:34] Christophe JOLIF
Even when building explicitely a CONCUR_UPDATABLE PreparatedStatement, ResultSet.getConcurrency() always return CONCUR_READONLY.

What is strange is that looking at source code the value is rightly put in a private resultSetConcurrency field of the ResultSet but never used as a returned value of ResultSet.getConcurrency().

How to repeat:
    Connection c = DriverManager.getConnection("jdbc:mysql:///test");
    PreparedStatement stmt = c.prepareStatement("select * from "+TABLE_NAME,
    ResultSet rs = stmt.executeQuery();
    if (rs.getConcurrency() != ResultSet.CONCUR_UPDATABLE)
    System.out.println(rs.getType()+" "+rs.getConcurrency());

Suggested fix:
    public int getConcurrency() throws SQLException {
        return resultSetConcurrency;

on ResultSet.java
[26 Oct 2004 12:49] Christophe JOLIF
Please close this bug, it seems I mistakely forgot to set a primary key on my table and so ResultSet objects are created instead of UpdatableResultSet objects (that have the right implementation for getConcurrency()).

Sorry for the trouble.