You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Kelvin Law (JIRA)" <ji...@apache.org> on 2010/06/10 19:32:12 UTC

[jira] Created: (OPENJPA-1691) Oracle XMLType column failed to insert/update when xml contains more than 4000 characters

Oracle XMLType column failed to insert/update when xml contains more than 4000 characters
-----------------------------------------------------------------------------------------

                 Key: OPENJPA-1691
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1691
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.2.2
         Environment: Oracle 10g, JDBC driver (ojdbc14.jar) 10.2.0.4.0, OpenJPA 1.2.2
            Reporter: Kelvin Law


Oracle throws the following exception when XML content is greater than 4000 characters:
ORA-01461: can bind a LONG value only for insert into a LONG column

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


[jira] Work started: (OPENJPA-1691) Oracle XMLType column failed to insert/update when xml contains more than 4000 characters

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

Work on OPENJPA-1691 started by Milosz Tylenda.

> Oracle XMLType column failed to insert/update when xml contains more than 4000 characters
> -----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1691
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1691
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Oracle 10g, JDBC driver (ojdbc14.jar) 10.2.0.4.0, OpenJPA 1.2.2
>            Reporter: Kelvin Law
>            Assignee: Milosz Tylenda
>
> Oracle throws the following exception when XML content is greater than 4000 characters:
> ORA-01461: can bind a LONG value only for insert into a LONG column

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


[jira] Commented: (OPENJPA-1691) Oracle XMLType column failed to insert/update when xml contains more than 4000 characters

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878366#action_12878366 ] 

Milosz Tylenda commented on OPENJPA-1691:
-----------------------------------------

Some work notes:

Neither PreparedStatement.setCharacterStream(int, Reader, int) nor OraclePreparedStatement.setStringForClob(int, String) helps here.
So far I have found two methods that seem to work with data over 4000 chars:

a)
1. Prepare a statement using XMLType constructor "insert into TORDERXML values(?, ?, ?, XMLType(?), ?, ?, ?)" 
2. Set the value by using PreparedStatement.setClob(int, Reader). This requires JDBC 4 (JDK 6). Tried with 11.2.0.1 driver.

b)
1. Prepare a statement using XMLType constructor "insert into TORDERXML values(?, ?, ?, XMLType(?), ?, ?, ?)" 
2. Create a temporary CLOB, fill it with XML data (similarly to [1]) and use PreparedStatement.setClob(int, Clob) or PreparedStatement.setObject(int, Object). This requires using Oracle-specific API and the temporary CLOB should be freed after statement execution. This works with 10.2.0.4 driver but 11.2.0.1 throws a bunch of ORAs:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00229: input source is empty
Error at line 0
ORA-06512: at "SYS.XMLTYPE", line 254
ORA-06512: at line 1

Neither method is a workaround for users to be applied solely in DBDictionary but requires a patch.

Kelvin, which JDK are you using?

[1] http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/Example_Code.html#createclob


> Oracle XMLType column failed to insert/update when xml contains more than 4000 characters
> -----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1691
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1691
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Oracle 10g, JDBC driver (ojdbc14.jar) 10.2.0.4.0, OpenJPA 1.2.2
>            Reporter: Kelvin Law
>            Assignee: Milosz Tylenda
>
> Oracle throws the following exception when XML content is greater than 4000 characters:
> ORA-01461: can bind a LONG value only for insert into a LONG column

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


[jira] Resolved: (OPENJPA-1691) Oracle XMLType column failed to insert/update when xml contains more than 4000 characters

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

Milosz Tylenda resolved OPENJPA-1691.
-------------------------------------

    Fix Version/s: 2.1.0
       Resolution: Fixed

The fix requires a JDBC 4 driver. There are still issues when querying over long individual XML nodes coming from obscure limits in Oracle's extractValue() function.

Note that reading XML values longer than 4000 bytes was also broken - replaced getStringVal() calls with getClobVal().

As a side effect users gained a bit of control on INSERT/UPDATE statements in DBDictionary.getMarkerForInsertUpdate method.


> Oracle XMLType column failed to insert/update when xml contains more than 4000 characters
> -----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1691
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1691
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 1.2.2, 2.0.0, 2.0.1
>         Environment: Oracle 10g, JDBC driver (ojdbc14.jar) 10.2.0.4.0, OpenJPA 1.2.2
>            Reporter: Kelvin Law
>            Assignee: Milosz Tylenda
>             Fix For: 2.1.0
>
>
> Oracle throws the following exception when XML content is greater than 4000 characters:
> ORA-01461: can bind a LONG value only for insert into a LONG column

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


[jira] Issue Comment Edited: (OPENJPA-1691) Oracle XMLType column failed to insert/update when xml contains more than 4000 characters

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12917398#action_12917398 ] 

Milosz Tylenda edited comment on OPENJPA-1691 at 10/3/10 5:04 PM:
------------------------------------------------------------------

The fix requires a JDBC 4 driver. There are still issues when querying over long individual XML nodes coming from obscure limits in Oracle's extractValue() function.

Note that reading XML values longer than 4000 bytes was also broken - replaced getStringVal() calls with getClobVal().

As a side effect users gained a bit of control on INSERT/UPDATE statements in DBDictionary.getMarkerForInsertUpdate method. One can do things like INSERT INTO tab(id, uppercased_name) VALUES (?, UPPER(?)).


      was (Author: milosz):
    The fix requires a JDBC 4 driver. There are still issues when querying over long individual XML nodes coming from obscure limits in Oracle's extractValue() function.

Note that reading XML values longer than 4000 bytes was also broken - replaced getStringVal() calls with getClobVal().

As a side effect users gained a bit of control on INSERT/UPDATE statements in DBDictionary.getMarkerForInsertUpdate method.

  
> Oracle XMLType column failed to insert/update when xml contains more than 4000 characters
> -----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1691
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1691
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 1.2.2, 2.0.0, 2.0.1
>         Environment: Oracle 10g, JDBC driver (ojdbc14.jar) 10.2.0.4.0, OpenJPA 1.2.2
>            Reporter: Kelvin Law
>            Assignee: Milosz Tylenda
>             Fix For: 2.1.0
>
>
> Oracle throws the following exception when XML content is greater than 4000 characters:
> ORA-01461: can bind a LONG value only for insert into a LONG column

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


[jira] Commented: (OPENJPA-1691) Oracle XMLType column failed to insert/update when xml contains more than 4000 characters

Posted by "Kelvin Law (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878570#action_12878570 ] 

Kelvin Law commented on OPENJPA-1691:
-------------------------------------

Hi Milosz,

I am using Sun JDK 1.5.0_22

> Oracle XMLType column failed to insert/update when xml contains more than 4000 characters
> -----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1691
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1691
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Oracle 10g, JDBC driver (ojdbc14.jar) 10.2.0.4.0, OpenJPA 1.2.2
>            Reporter: Kelvin Law
>            Assignee: Milosz Tylenda
>
> Oracle throws the following exception when XML content is greater than 4000 characters:
> ORA-01461: can bind a LONG value only for insert into a LONG column

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


[jira] Updated: (OPENJPA-1691) Oracle XMLType column failed to insert/update when xml contains more than 4000 characters

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

Milosz Tylenda updated OPENJPA-1691:
------------------------------------

    Affects Version/s: 2.0.1
                       2.0.0
          Component/s: sql

> Oracle XMLType column failed to insert/update when xml contains more than 4000 characters
> -----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1691
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1691
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 1.2.2, 2.0.0, 2.0.1
>         Environment: Oracle 10g, JDBC driver (ojdbc14.jar) 10.2.0.4.0, OpenJPA 1.2.2
>            Reporter: Kelvin Law
>            Assignee: Milosz Tylenda
>
> Oracle throws the following exception when XML content is greater than 4000 characters:
> ORA-01461: can bind a LONG value only for insert into a LONG column

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


[jira] Assigned: (OPENJPA-1691) Oracle XMLType column failed to insert/update when xml contains more than 4000 characters

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

Milosz Tylenda reassigned OPENJPA-1691:
---------------------------------------

    Assignee: Milosz Tylenda

> Oracle XMLType column failed to insert/update when xml contains more than 4000 characters
> -----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1691
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1691
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Oracle 10g, JDBC driver (ojdbc14.jar) 10.2.0.4.0, OpenJPA 1.2.2
>            Reporter: Kelvin Law
>            Assignee: Milosz Tylenda
>
> Oracle throws the following exception when XML content is greater than 4000 characters:
> ORA-01461: can bind a LONG value only for insert into a LONG column

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