db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Hanin" <xavier.ha...@gmail.com>
Subject Bug in Embedded Driver?
Date Sat, 31 Mar 2007 11:33:38 GMT
Hi Derby community,

I'm currently using Derby on a freshly started project, and I ran into an
issue which seems to be a bug.

Indeed the same code works well with the Client Driver, and not with the
Embedded Driver. The error I get from Derby is:
 org.apache.derby.impl.jdbc.EmbedSQLException: An attempt was made to get a
data value of type 'VARCHAR' from a data value of type 'VARBINARY'

Here is a code snippet reproducing the problem:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Types;

import org.apache.derby.jdbc.ClientDriver;
import org.apache.derby.jdbc.EmbeddedDriver;

public class DerbyTest {
    public static void main(String[] args) throws Exception {
//        Class.forName(ClientDriver.class.getName());
        Connection con =
"app", "app");
//        Connection con =
"app", "app");
        try {
            con.createStatement().executeUpdate("create table Issue ( ID
char(50) )");
            PreparedStatement st = con.prepareStatement("select count(*)
from Issue where ? is null");
            st.setNull(1, Types.VARBINARY);
            ResultSet rs = st.executeQuery();
        } finally {
If you switch to the ClientDriver, it's working properly.

Is it a bug? Or is it an incorrect use of the JDBC API, working with client
driver by chance?

FYI, here's some details on my environment:
Sun Windows JDK 6.0


Learn Ivy at ApacheCon: http://www.eu.apachecon.com/
Manage your dependencies with Ivy!

View raw message