It seems to me that the compiler should not think it has enough information at prepareStatement() time to assign the ? a type of VARCHAR. That looks like a bug to me.

As a workaround, the following statement gives the compiler enough information to correctly type the ? parameter. This allows you to set the ? parameter to a null VARBINARY value and then execute the query. This works under both the embedded and network clients:

select count(*) from Issue where cast (? as varchar(20) for bit data) is null


Regards,
Rick

Xavier Hanin wrote:
On 3/31/07, *Oystein Grovlen - Sun Norway* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Xavier Hanin wrote:
    > On 3/31/07, *Øystein Grøvlen* <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>

    > I'm using  version 10.2.2.0 <http://10.2.2.0> < http://10.2.2.0>.
    >
    >       There have been some
    >     fixes in this area lately (see DERBY-1610), and I will try
    your test
    >     case on the development trunk later today.
    >
    >
    > Ok, thanks a lot.

    I tried the development version, and now it fails for both client and
    embedded.  The failure in the client is probably due to stricter type
    checking in the client driver.  What happens seems to be that the
    compiler determines the type of the parameter to be VARCHAR during
    compilation, and hence you get a type mismatch later.  I do not
    understand why it does so.  If nobody can explain why, this is
    probably
a bug, and I suggest you open a new JIRA issue for this.

JIRA issue created: DERBY-2507

Thanks for your help!

- Xavier

    --
    Øystein




--
Learn Ivy at ApacheCon: http://www.eu.apachecon.com/
Manage your dependencies with Ivy!
http://incubator.apache.org/ivy/

Reply via email to