[
https://issues.apache.org/jira/browse/CAY-1231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715048#action_12715048
]
Andrus Adamchik commented on CAY-1231:
--------------------------------------
Eugene,
our testing shows this is related to the Oracle driver version. We used Oracle
9 in both tests:
1. We get an error on 'setString' when the string is longer than 32765.
Manifest-Version: 1.0
Specification-Title: "Oracle JDBC driver classes for use with JDK1.4"
Specification-Version: "Oracle JDBC Driver version - 9.0.2.0.0"
Specification-Vendor: "Oracle Corporation" .
Implementation-Title: "ojdbc14_g.jar"
Implementation-Version: "Oracle JDBC Driver version - 9.0.2.0.0"
Implementation-Vendor: "Oracle Corporation"
Implementation-Time: "Thu Apr 25 23:48:25 2002"
2.
Specification-Version: Oracle JDBC Driver version - "11.1.0.6.0-Produc
tion"
Implementation-Version: Oracle JDBC Driver version - "11.1.0.6.0-Produ
ction"
Here is some information from Oracle on the topic.
We get no error on setString even with multi-megabyte Clobs.
Also we tried using 'setClob' - this doesn't work with an arbitrary
implementation of Clob (the one we use in Cayenne is called MemoryClob, Oracle
expects its own I guess). So please try upgrading the driver.
Also here is some Oracle wisdom on the use of Clobs:
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/clob10g/handlingclobsinoraclejdbc10g.html
Specifically check out this paragraph, that mentions a workaround for Oracle 10
drivers:
"The enhanced standard APIs for manipulating CLOBs are the setString() and
getString() of the PreparedStatement and ResultSet objects respectively. By
default, the method preparedStatement.setString() will allow processing of the
strings up to 32765 bytes. In order to insert data greater than 32765 bytes, a
newly introduced Connection property - SetBigStringTryClob can be set. This
forces the preparedStatement.setString() to use another newly introduced
method, OraclePreparedStatement.setStringForClob() instead. This is actually
done internally, transparent to the user."
> Problem with CLOB field under Oracle
> ------------------------------------
>
> Key: CAY-1231
> URL: https://issues.apache.org/jira/browse/CAY-1231
> Project: Cayenne
> Issue Type: Bug
> Components: Cayenne Core Library
> Affects Versions: 2.0 branch
> Environment: Oracle 10g, Cayenne 2.0.4, Java 1.5
> Reporter: Eugene Matyushkin
> Assignee: Andrus Adamchik
> Priority: Critical
> Fix For: 2.0.5
>
>
> 1. Creating table:
> CREATE TABLE CRM_PDOCTYPECAT (
> PDOCTYPECATID NUMERIC(19,0) NOT NULL,
> CATNAME VARCHAR(255) NOT NULL,
> CATDESCRIPTION CLOB NULL
> );
> 2. Creating named query
> INSERT INTO CRM_PDOCTYPECAT(
> PDOCTYPECATID,
> CATNAME,
> CATDESCRIPTION
> ) VALUES (
> #bind($PDOCTYPECATID 'NUMERIC'),
> #bind($CATNAME 'VARCHAR'),
> #bind($CATDESCRIPTION 'CLOB')
> )
> 3. Binding very long (more then 32766 chars) string to CATDESCRIPTION.
> 4. Executing query
> Result:
> 2009-05-28 13:32:03,053 [main] INFO org.apache.cayenne.access.QueryLogger -
> *** error.
> java.sql.SQLException: setString can process only strings less then 32766
> symbols in length
> at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
> at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
> at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
> at
> oracle.jdbc.driver.OraclePreparedStatement.setStringInternal(OraclePreparedStatement.java:4588)
> at
> oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.java:4559)
> I guess, setClob should be used instead of setString when working with CLOBs.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.