db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak" <tom...@gmail.com>
Subject Re: The tutorial on migrating DB to derby
Date Wed, 14 Jun 2006 22:38:51 GMT
On 6/14/06, Kathey Marsden <kmarsdenderby@sbcglobal.net> wrote:

<snip>

> Caused by: SQL Exception: Zero or negative length argument '0' passed in
> a BLOB or CLOB method.
>         at
> org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:80)
>         at
> org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at
> org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:166)
>         at
> org.apache.derby.impl.jdbc.EmbedClob.getSubString(EmbedClob.java:206)
>         at
> org.apache.ddlutils.platform.PlatformImplBase.extractColumnValue(PlatformImplBase.java:1961)

<snip>

Well, I haven't done much with Clobs lately, but the code in question


Clob clob = resultSet.getClob(columnName);

if ((clob == null) || (clob.length() > Integer.MAX_VALUE))
{
    value = clob;
}
else
{
    value = clob.getSubString(1l, (int)clob.length());
}


seems to be ok according to the Clob javadocs
(http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Clob.html#getSubString(long,%20int)),
right ? A string is only returned (and getSubString called) if the
length of the clob is within int range, so length() seems to return a
value <= 0 ?

Tom

Mime
View raw message