Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5049502

CachedRowSet fails on acceptChanges()

XMLWordPrintable

    • rc
    • x86
    • windows_2000



      Name: gm110360 Date: 05/18/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      mysql Connector/J driver 3.0.11-stable
      mysql server 4.0.17-nt

      A DESCRIPTION OF THE PROBLEM :
      CachedRowSet fails even with simplest update. The CachedRowSet appears to be delivering some non-sensical sql to the server when acceptChanges() is invoked.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute provided source code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No returned error condition.
      ACTUAL -
      Value: zzz

      Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id = 224 AND qqq = 'zzz' AND firstname = 'W.' AND middlen"

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id = 1 AND col1 = 'zzz' AND col2 = 'W' AND col3"

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.SQLException;
      import javax.sql.rowset.CachedRowSet;
      import com.sun.rowset.CachedRowSetImpl;

      public class Fail {
      public static void main(String[] args) throws ClassNotFoundException, SQLException {

      Class.forName("com.mysql.jdbc.Driver");
      Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/db?user=root");

      CachedRowSet crs = new CachedRowSetImpl();

      crs.setCommand("select * from table where id = 1");
      crs.execute(conn);

      crs.first();

      System.out.println("Value:" + crs.getString(1));

      crs.updateString(1, "xxx");
      crs.updateRow();

      crs.acceptChanges();
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      none found
      (Incident Review ID: 269966)
      ======================================================================

            skaushiksunw Shreyas Kaushik (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: