Hi,
Could you post a reproducible test case? I can't reproduce the problem
so far. My test case is:
import java.sql.*;
import org.h2.tools.DeleteDbFiles;
public class Test {
public static void main(String[] args) throws Exception {
Class.forName("org.h2.Driver");
DeleteDbFiles.execute("~", "test", true);
Connection conn = DriverManager.getConnection(
"jdbc:h2:~/test", "sa", "sa");
Statement stmt = conn.createStatement();
stmt.execute("create table wordforms(key INT " +
"NOT NULL PRIMARY KEY AUTO_INCREMENT, " +
"key_base INT, name VARCHAR(50), " +
"type VARCHAR(10), isProcessed BOOLEAN)");
PreparedStatement prep = conn.prepareStatement(
"insert into wordforms values(?, ?, space(30)||?, ?, true)");
System.out.println("inserting");
for (int i = 0; i < 1300000; i++) {
if (i % 100000 == 0) {
System.out.println(i);
}
prep.setInt(1, i);
prep.setInt(2, i);
prep.setInt(3, i);
prep.setInt(4, i);
prep.execute();
}
System.out.println("selecting");
ResultSet rs = stmt.executeQuery(
"select key from wordforms");
for (int i = 0; rs.next(); i++) {
if (i % 100000 == 0) {
System.out.println(i);
}
rs.getInt(1);
}
System.out.println("done");
conn.close();
}
}
Regards,
Thomas
On Tue, May 26, 2009 at 9:04 PM, Dror <[email protected]> wrote:
>
> You should
> increase your Heap memory.
> try to add the following to your java command line.
> XX:MaxPermSize=128m -Xms256m -Xmx1024m
> Regards
> Dror
>
> On May 25, 3:34 pm, "Alexander.Sirenko" <[email protected]>
> wrote:
>> My connection string is "jdbc:h2:file:c:\\db/tesh2;CACHE_SIZE=50000".
>> I think, my database stored on disk.
>>
>> On May 25, 10:53 am, Steve McLeod <[email protected]> wrote:
>>
>>
>>
>> > Hi Alexander,
>>
>> > Can you post your database connection url?
>>
>> > My guess is that you have an in-memory database and are using the
>> > default Java memory configuration. If that's the case, you'll need to
>> > start up your program with increased heap size.
>>
>> > Regards,
>>
>> > Steve
>>
>> > On May 24, 10:04 pm, "Alexander.Sirenko" <[email protected]>
>> > wrote:
>>
>> > > Hello,
>> > > I have some large table
>> > > wordforms(key INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
>> > > key_base INT,
>> > > name VARCHAR(50),
>> > > type VARCHAR(10),
>> > > isProcessed BOOLEAN )
>> > > with about 1 300 000 entries.
>>
>> > > In my Java program I make query "SELECT key FROM wordforms" to get all
>> > > keys.
>> > > Executing query causes exception:
>>
>> > > Exception in thread "Thread-7" java.lang.OutOfMemoryError: Java heap
>> > > space
>> > > at org.h2.value.Value.cache(Value.java:338)
>> > > at org.h2.value.ValueString.get(ValueString.java:91)
>> > > at org.h2.store.DataPage.readValue(DataPage.java:623)
>> > > at org.h2.table.TableData.readRow(TableData.java:620)
>> > > at org.h2.table.TableData.read(TableData.java:607)
>> > > at org.h2.store.DiskFile.getRecord(DiskFile.java:595)
>> > > at org.h2.store.Storage.getRecord(Storage.java:94)
>> > > at org.h2.index.ScanIndex.getNextRow(ScanIndex.java:258)
>> > > at org.h2.index.ScanCursor.next(ScanCursor.java:71)
>> > > at org.h2.table.TableFilter.next(TableFilter.java:318)
>> > > at org.h2.command.dml.Select.queryFlat(Select.java:491)
>> > > at org.h2.command.dml.Select.queryWithoutCache(Select.java:
>> > > 559)
>> > > at org.h2.command.dml.Query.query(Query.java:233)
>> > > at org.h2.command.CommandContainer.query(CommandContainer.java:
>> > > 81)
>> > > at org.h2.command.Command.executeQueryLocal(Command.java:141)
>> > > at org.h2.command.Command.executeQuery(Command.java:122)
>> > > at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:
>> > > 75)
>>
>> > > // NetBeans error message
>>
>> > > I use h2.1.1.111 in embedded mode.
>> > > I tried different CACHE_SIZE from CACHE_SIZE=25000 to
>> > > CACHE_SIZE=200000
>>
>> > > Database includes other tables and it is more than 1.5Gb- Hide quoted
>> > > text -
>>
>> - Show quoted text -
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---