tudoutiao / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

NUllPointerException when inserting lots of entries on Linux #137

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
(simple SQL scripts or simple standalone applications are preferred)
1. String dbURL = "jdbc:h2:my_db" + 
     ";CACHE_SIZE=65536;LOCK_MODE=0;LOG=0;UNDO_LOG=0;FILE_LOCK=NO;
REFERENTIAL_INTEGRITY=FALSE;AUTOCOMMIT=OFF";

     Class.forName("org.h2.Driver");
     conn = DriverManager.getConnection(dbURL);

     ...

     String insertSQL = "INSERT INTO my_table (" +
        "my_id, " + ...  // 23 INTEGER, 11 VARCHAR(50)s, 5 BIGINTEGER
            ") VALUES (" + 
            "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " +
            "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " +
            "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " +
            "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? " +
            ");";
        PreparedStatement pstmt = conn.prepareStatement(insertSQL);
        for (int i = 0; i < 1000000; ++i) {
        try {
                int n = 0;
            pstmt.setLong(++n, i);
                ...
            pstmt.executeUpdate();
            }
        }
        conn.commit();

What is the expected output? What do you see instead?
org.h2.jdbc.JdbcSQLException: General error:
"java.lang.NullPointerException"; SQL statement:
COMMIT [50000-123]
    at org.h2.message.Message.getSQLException(Message.java:111)
    at org.h2.message.Message.convert(Message.java:288)
    at org.h2.command.Command.executeUpdate(Command.java:229)
    at org.h2.jdbc.JdbcConnection.commit(JdbcConnection.java:405)
    at test.TestH2.insertRows(TestH2.java:311)
    at test.TestH2.main(TestH2.java:44)

What version of the product are you using? On what operating system, file
system, and virtual machine?
Version 1.2.123 (2009-11-08, Beta) ( same result was on Version 1.2.122 )
OS: Linux Red Hat 4

Do you know a workaround?
No

How important/urgent is the problem for you?
Very important, we can not use H2 if this isn't solved.

In your view, is this a defect or a feature request?
defect

Please provide any additional information below.
didn't get an exception on Windows.

Original issue reported on code.google.com by alex...@gmail.com on 10 Nov 2009 at 1:23

GoogleCodeExporter commented 8 years ago
It works when we stored the database on local disk (rather than on afs). The 
problem
may have been due to running out of disk space. You may close the issue. Thank 
you.

Original comment by alex...@gmail.com on 11 Nov 2009 at 1:50

GoogleCodeExporter commented 8 years ago
Closing as requested

Original comment by thomas.t...@gmail.com on 13 Nov 2009 at 5:20