Hi list,

I regularly read the Harmony development archives, and there was a post
about Dacapo benchmarks with the H2 database. I also tested some of my
applications against Harmony, and I have problems with H2. I narrowed it
down to a small testcase. RI works fine, Harmony doesn't work (on Fedora
12, all Updates). This is on 32 bit, 64 bit seems to be Ok.

Just use the attached file and the jar file found in
http://www.h2database.com/h2-2010-03-21.zip and let it run.

Regards

Christian Peter
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;

public class Simple {

    public static void main(String... args) {
        try {
            System.out.println(Runtime.getRuntime().maxMemory());
            Class.forName("org.h2.Driver");
            String url = "jdbc:h2:data;CACHE_SIZE=10000";
            Connection conn = DriverManager.getConnection(url);
            Statement stat = conn.createStatement();
            stat.execute("drop table account if exists");
            stat.execute("create table account(name varchar primary key)");
            PreparedStatement prep = conn.prepareStatement("insert into account(name) values(?)");
            
            for (int i = 0; i < 90000; i++) {
                prep.setString(1, "Test" + i);
                prep.execute();
            }
            
            conn.close();
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
    
}

Reply via email to