You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Fernanda Pizzorno (JIRA)" <ji...@apache.org> on 2006/11/21 14:40:05 UTC

[jira] Created: (DERBY-2105) Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.

Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.
----------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: DERBY-2105
                 URL: http://issues.apache.org/jira/browse/DERBY-2105
             Project: Derby
          Issue Type: Bug
          Components: Network Client
            Reporter: Fernanda Pizzorno


REPRO:

            Statement stmt1 = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
                    ResultSet.CONCUR_UPDATABLE);
            Statement stmt2 = conn.createStatement();

            stmt1.executeUpdate("CREATE TABLE t1 (i int, c char(60))");
            stmt1.executeUpdate("CREATE TABLE t2 (i int, c clob(1K))");
            stmt1.executeUpdate("INSERT INTO t1 values (1, 'xx')");
            stmt1.executeUpdate("INSERT INTO t2 values (1, 'yy')");

            ResultSet rs1 = stmt1.executeQuery("SELECT * FROM t1");
            ResultSet rs2 = stmt2.executeQuery("SELECT * FROM t2");

            if (!rs1.next()) {
                System.out.println("Row not found");
                return;
            }
            if (!rs2.next()) {
                System.out.println("Row not found");
                return;            
            }

            rs1.updateObject(2, rs2.getClob(2));

            rs1.updateRow();
            rs1.close();


            rs1 = stmt1.executeQuery("SELECT * FROM t1");
            if (!rs1.next()) {
                System.out.println("Row not found");
                return;
            }
            if (!rs2.getString(2).equals(rs1.getString(2))) {
                System.out.println("FAIL - wrong value for column 2 expected: " + 
                        rs2.getString(2) + " but was: " + rs1.getString(2));
            }
            rs1.close();
            rs2.close();        
            stmt1.close();
            stmt2.close();

OUTPUT:
FAIL - wrong value for column 2 expected: yy but was: org.apache.derby.client.am.Clob@336d8196

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DERBY-2105) Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12591849#action_12591849 ] 

Kathey Marsden commented on DERBY-2105:
---------------------------------------

I verified Mamta's results and I think the error is an acceptable one for this case.  Can this issue be closed as invalid?



> Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2105
>                 URL: https://issues.apache.org/jira/browse/DERBY-2105
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>            Reporter: Fernanda Pizzorno
>
> REPRO:
>             Statement stmt1 = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
>                     ResultSet.CONCUR_UPDATABLE);
>             Statement stmt2 = conn.createStatement();
>             stmt1.executeUpdate("CREATE TABLE t1 (i int, c char(60))");
>             stmt1.executeUpdate("CREATE TABLE t2 (i int, c clob(1K))");
>             stmt1.executeUpdate("INSERT INTO t1 values (1, 'xx')");
>             stmt1.executeUpdate("INSERT INTO t2 values (1, 'yy')");
>             ResultSet rs1 = stmt1.executeQuery("SELECT * FROM t1");
>             ResultSet rs2 = stmt2.executeQuery("SELECT * FROM t2");
>             if (!rs1.next()) {
>                 System.out.println("Row not found");
>                 return;
>             }
>             if (!rs2.next()) {
>                 System.out.println("Row not found");
>                 return;            
>             }
>             rs1.updateObject(2, rs2.getClob(2));
>             rs1.updateRow();
>             rs1.close();
>             rs1 = stmt1.executeQuery("SELECT * FROM t1");
>             if (!rs1.next()) {
>                 System.out.println("Row not found");
>                 return;
>             }
>             if (!rs2.getString(2).equals(rs1.getString(2))) {
>                 System.out.println("FAIL - wrong value for column 2 expected: " + 
>                         rs2.getString(2) + " but was: " + rs1.getString(2));
>             }
>             rs1.close();
>             rs2.close();        
>             stmt1.close();
>             stmt2.close();
> OUTPUT:
> FAIL - wrong value for column 2 expected: yy but was: org.apache.derby.client.am.Clob@336d8196

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2105) Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.

Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538087 ] 

Mamta A. Satoor commented on DERBY-2105:
----------------------------------------

I tried the test case in Embedded mode (the earlier results were from running the program in client server mode) and similar (not exactly the same) is thrown in Embedded configuration too (again, this is by testing the supplied sample code against Derby 1.4 using Sun's jdk142)
 
$ java org.apache.derbyTesting.functionTests.tests.lang.DBMetaData2
Exception in thread "main" java.sql.SQLException: An attempt was made to get a data value of type 'CHAR' from a data value of type 'java.sql.Clob'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:88)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:94)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:180)
        at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnection.java:2238)
        at org.apache.derby.impl.jdbc.ConnectionChild.newSQLException(ConnectionChild.java:154)
        at org.apache.derby.impl.jdbc.EmbedResultSet.dataTypeConversion(EmbedResultSet.java:4522)
        at org.apache.derby.impl.jdbc.EmbedResultSet.updateClob(EmbedResultSet.java:4154)
        at org.apache.derby.impl.jdbc.EmbedResultSet.updateObject(EmbedResultSet.java:3144)
        at org.apache.derby.impl.jdbc.EmbedResultSet20.updateObject(EmbedResultSet20.java:210)
        at org.apache.derbyTesting.functionTests.tests.lang.DBMetaData2.main(DBMetaData2.java:200)

> Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2105
>                 URL: https://issues.apache.org/jira/browse/DERBY-2105
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>            Reporter: Fernanda Pizzorno
>
> REPRO:
>             Statement stmt1 = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
>                     ResultSet.CONCUR_UPDATABLE);
>             Statement stmt2 = conn.createStatement();
>             stmt1.executeUpdate("CREATE TABLE t1 (i int, c char(60))");
>             stmt1.executeUpdate("CREATE TABLE t2 (i int, c clob(1K))");
>             stmt1.executeUpdate("INSERT INTO t1 values (1, 'xx')");
>             stmt1.executeUpdate("INSERT INTO t2 values (1, 'yy')");
>             ResultSet rs1 = stmt1.executeQuery("SELECT * FROM t1");
>             ResultSet rs2 = stmt2.executeQuery("SELECT * FROM t2");
>             if (!rs1.next()) {
>                 System.out.println("Row not found");
>                 return;
>             }
>             if (!rs2.next()) {
>                 System.out.println("Row not found");
>                 return;            
>             }
>             rs1.updateObject(2, rs2.getClob(2));
>             rs1.updateRow();
>             rs1.close();
>             rs1 = stmt1.executeQuery("SELECT * FROM t1");
>             if (!rs1.next()) {
>                 System.out.println("Row not found");
>                 return;
>             }
>             if (!rs2.getString(2).equals(rs1.getString(2))) {
>                 System.out.println("FAIL - wrong value for column 2 expected: " + 
>                         rs2.getString(2) + " but was: " + rs1.getString(2));
>             }
>             rs1.close();
>             rs2.close();        
>             stmt1.close();
>             stmt2.close();
> OUTPUT:
> FAIL - wrong value for column 2 expected: yy but was: org.apache.derby.client.am.Clob@336d8196

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2105) Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.

Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538058 ] 

Mamta A. Satoor commented on DERBY-2105:
----------------------------------------

I tried the sample test case provided in this jira entry and I get following exception
$ java org.apache.derbyTesting.functionTests.tests.lang.DBMetaData2
Exception in thread "main" java.sql.SQLException: An attempt was made to put a data value of type 'java.sql.Clob' into a data value of type 'CHAR'.
        at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:46)
        at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:362)
        at org.apache.derby.client.am.ResultSet.updateObject(ResultSet.java:3105)
        at org.apache.derbyTesting.functionTests.tests.lang.DBMetaData2.main(DBMetaData2.java:200)
Caused by: org.apache.derby.client.am.SqlException: An attempt was made to put a data value of type 'java.sql.Clob' into a data value of type 'CHAR'.
        at org.apache.derby.client.am.CrossConverters.setObject(CrossConverters.java:810)
        at org.apache.derby.client.am.CrossConverters.setObject(CrossConverters.java:846)
        at org.apache.derby.client.am.ResultSet.updateObject(ResultSet.java:3100)

Fernanda, am I doing something different than you? I will  look further into it myself. I am testing against the trunk which is Derby 1.4 using Sun's jdk142

> Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2105
>                 URL: https://issues.apache.org/jira/browse/DERBY-2105
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>            Reporter: Fernanda Pizzorno
>
> REPRO:
>             Statement stmt1 = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
>                     ResultSet.CONCUR_UPDATABLE);
>             Statement stmt2 = conn.createStatement();
>             stmt1.executeUpdate("CREATE TABLE t1 (i int, c char(60))");
>             stmt1.executeUpdate("CREATE TABLE t2 (i int, c clob(1K))");
>             stmt1.executeUpdate("INSERT INTO t1 values (1, 'xx')");
>             stmt1.executeUpdate("INSERT INTO t2 values (1, 'yy')");
>             ResultSet rs1 = stmt1.executeQuery("SELECT * FROM t1");
>             ResultSet rs2 = stmt2.executeQuery("SELECT * FROM t2");
>             if (!rs1.next()) {
>                 System.out.println("Row not found");
>                 return;
>             }
>             if (!rs2.next()) {
>                 System.out.println("Row not found");
>                 return;            
>             }
>             rs1.updateObject(2, rs2.getClob(2));
>             rs1.updateRow();
>             rs1.close();
>             rs1 = stmt1.executeQuery("SELECT * FROM t1");
>             if (!rs1.next()) {
>                 System.out.println("Row not found");
>                 return;
>             }
>             if (!rs2.getString(2).equals(rs1.getString(2))) {
>                 System.out.println("FAIL - wrong value for column 2 expected: " + 
>                         rs2.getString(2) + " but was: " + rs1.getString(2));
>             }
>             rs1.close();
>             rs2.close();        
>             stmt1.close();
>             stmt2.close();
> OUTPUT:
> FAIL - wrong value for column 2 expected: yy but was: org.apache.derby.client.am.Clob@336d8196

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-2105) Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan closed DERBY-2105.
----------------------------------


Issue not longer reproducible, and already marked as invalid.
Closing.

> Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2105
>                 URL: https://issues.apache.org/jira/browse/DERBY-2105
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>            Reporter: Fernanda Pizzorno
>
> REPRO:
>             Statement stmt1 = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
>                     ResultSet.CONCUR_UPDATABLE);
>             Statement stmt2 = conn.createStatement();
>             stmt1.executeUpdate("CREATE TABLE t1 (i int, c char(60))");
>             stmt1.executeUpdate("CREATE TABLE t2 (i int, c clob(1K))");
>             stmt1.executeUpdate("INSERT INTO t1 values (1, 'xx')");
>             stmt1.executeUpdate("INSERT INTO t2 values (1, 'yy')");
>             ResultSet rs1 = stmt1.executeQuery("SELECT * FROM t1");
>             ResultSet rs2 = stmt2.executeQuery("SELECT * FROM t2");
>             if (!rs1.next()) {
>                 System.out.println("Row not found");
>                 return;
>             }
>             if (!rs2.next()) {
>                 System.out.println("Row not found");
>                 return;            
>             }
>             rs1.updateObject(2, rs2.getClob(2));
>             rs1.updateRow();
>             rs1.close();
>             rs1 = stmt1.executeQuery("SELECT * FROM t1");
>             if (!rs1.next()) {
>                 System.out.println("Row not found");
>                 return;
>             }
>             if (!rs2.getString(2).equals(rs1.getString(2))) {
>                 System.out.println("FAIL - wrong value for column 2 expected: " + 
>                         rs2.getString(2) + " but was: " + rs1.getString(2));
>             }
>             rs1.close();
>             rs2.close();        
>             stmt1.close();
>             stmt2.close();
> OUTPUT:
> FAIL - wrong value for column 2 expected: yy but was: org.apache.derby.client.am.Clob@336d8196

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-2105) Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden resolved DERBY-2105.
-----------------------------------

    Resolution: Invalid

The wrong results seems to no longer be an issue.  The case throws what appears to be an acceptable error message for both embedded and client.



> Network Client - Column of type CHAR, VARCHAR or LONG VARCHAR contains wrong value after being updated using the updateObject() method with a clob as parameter.
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2105
>                 URL: https://issues.apache.org/jira/browse/DERBY-2105
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>            Reporter: Fernanda Pizzorno
>
> REPRO:
>             Statement stmt1 = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
>                     ResultSet.CONCUR_UPDATABLE);
>             Statement stmt2 = conn.createStatement();
>             stmt1.executeUpdate("CREATE TABLE t1 (i int, c char(60))");
>             stmt1.executeUpdate("CREATE TABLE t2 (i int, c clob(1K))");
>             stmt1.executeUpdate("INSERT INTO t1 values (1, 'xx')");
>             stmt1.executeUpdate("INSERT INTO t2 values (1, 'yy')");
>             ResultSet rs1 = stmt1.executeQuery("SELECT * FROM t1");
>             ResultSet rs2 = stmt2.executeQuery("SELECT * FROM t2");
>             if (!rs1.next()) {
>                 System.out.println("Row not found");
>                 return;
>             }
>             if (!rs2.next()) {
>                 System.out.println("Row not found");
>                 return;            
>             }
>             rs1.updateObject(2, rs2.getClob(2));
>             rs1.updateRow();
>             rs1.close();
>             rs1 = stmt1.executeQuery("SELECT * FROM t1");
>             if (!rs1.next()) {
>                 System.out.println("Row not found");
>                 return;
>             }
>             if (!rs2.getString(2).equals(rs1.getString(2))) {
>                 System.out.println("FAIL - wrong value for column 2 expected: " + 
>                         rs2.getString(2) + " but was: " + rs1.getString(2));
>             }
>             rs1.close();
>             rs2.close();        
>             stmt1.close();
>             stmt2.close();
> OUTPUT:
> FAIL - wrong value for column 2 expected: yy but was: org.apache.derby.client.am.Clob@336d8196

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.