db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafal Rusin <rafal.ru...@gmail.com>
Subject Hang while using delete in (?, ?) prepared statement for two nulls
Date Thu, 08 Oct 2009 20:16:29 GMT
Hello,

I'm a committer from Apache ODE. We had a hang on derby 10.5.3.0 while
we used such prepared statement.
We use JTA environment with Tranql and Geronimo embedded, but I think
it's not related to this problem.

Here's a code to reproduce this hang:

{
           tm.begin();
            Connection conn = ((DataSource)
getBean("localDerbyDataSource")).getConnection();
            Statement s = conn.createStatement();
            s.execute("create table test_table (id bigint primary key,
v bigint)");
            s.execute("insert into test_table values (1,1)");
            s.execute("insert into test_table values (2,2)");
            s.execute("insert into test_table values (3,3)");
            s.execute("insert into test_table values (4,4)");
            s.execute("insert into test_table values (5,5)");
            s.close();
            tm.commit();
        }

        {
            tm.begin();
            Connection conn = ((DataSource)
getBean("localDerbyDataSource")).getConnection();
            PreparedStatement s = conn.prepareStatement("delete from
test_table where id in (?, ?)");
            s.setObject(1, null, java.sql.Types.BIGINT);
            s.setObject(2, null, java.sql.Types.BIGINT);
            s.execute();
            s.close();
            tm.commit();
        }


This statement doesn't make much sense, but we lost a lot of time
figuring out what's going on. Alexis Midon found eventually a cause.

Is there a chance of fixing it (or at least throwing error on nulls)?

FYI, here's an entry in ODE jira: https://issues.apache.org/jira/browse/ODE-671

Regards,
-- 
RafaƂ Rusin
http://www.touk.pl
http://top.touk.pl
http://people.apache.org/~rr/

Mime
View raw message