Hi folks !
I have question about nioMapped DB. My example down at 30' iteration.
org.h2.jdbc.JdbcSQLException: IO Exception: "java.io.IOException";
"split:30:nioMapped:D:/developing/test/cache.dat.h2.db" [90031-168]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.DbException.convertIOException(DbException.java:315)
at org.h2.store.FileStore.sync(FileStore.java:416)
at org.h2.store.PageStore.writeVariableHeader(PageStore.java:947)
at org.h2.store.PageStore.setLogFirstPage(PageStore.java:941)
at org.h2.store.PageLog.removeUntil(PageLog.java:706)
at org.h2.store.PageStore.checkpoint(PageStore.java:434)
at org.h2.store.PageStore.commit(PageStore.java:1438)
at org.h2.engine.Database.commit(Database.java:1768)
at org.h2.engine.Session.commit(Session.java:450)
at org.h2.command.Command.stop(Command.java:148)
at org.h2.command.Command.executeUpdate(Command.java:259)
at
org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:194)
at cache.H2Test.main(H2Test.java:46)
Caused by: java.io.IOException
at java.nio.MappedByteBuffer.force0(Native Method)
at java.nio.MappedByteBuffer.force(Unknown Source)
at org.h2.store.fs.FileNioMapped.force(FilePathNioMapped.java:219)
at org.h2.store.fs.FileSplit.force(FilePathSplit.java:336)
at org.h2.store.FileStore.sync(FileStore.java:413)
... 11 more
OS : WIN 7 64bit, 8G RAM
JVM :
Java(TM) SE Runtime Environment (build 1.6.0_34-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.9-b04, mixed mode)
java -Xmx128M
I'm new at H2 DB. If you have some ideas please answer.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/h2-database/-/4qrzafirbd0J.
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.
package cache;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.Date;
import org.apache.commons.io.FileUtils;
public class H2Test {
/**
* @param args
* ArtjomAminov
* 23 Oct 2012 15:22:02
*/
public static void main(String[] args) {
try{
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:split:nioMapped:D:\\developing\\test\\cache.dat;DB_CLOSE_ON_EXIT=FALSE;MVCC=TRUE;LOCK_MODE=1");
Statement st = conn.createStatement();
/*
ResultSet rs = st.executeQuery("select * from CACHE_DATA");
while (rs.next()){
System.out.println(rs.getString(1) + " " + rs.getDate(2));
}
rs.close();
*/
System.out.println(st.execute("CREATE TABLE IF NOT EXISTS CACHE_DATA (ID VARCHAR PRIMARY KEY, INPUT TIMESTAMP, CONTENT BINARY)"));
st.close();
byte content [] = FileUtils.readFileToByteArray(new File("D:\\developing\\test\\repo\\test_file.dat"));
//file size 1574kb
PreparedStatement prep = conn.prepareStatement("INSERT INTO CACHE_DATA VALUES(?, ?, ?)");
for (int i = 0; i < 100;i++){
prep.setString(1, i + "");
prep.setTimestamp(2, new Timestamp(new Date().getTime()));
prep.setBytes(3, content);
prep.execute();
System.out.println(i);
}
st.close();
conn.close();
System.out.println("End");
Thread.sleep(5000);
}catch(Exception e){
e.printStackTrace();
}
}
}