Hi, Why do you use FILE_LOCK=NO? Usually there is no need, and it's dangerous: http://www.h2database.com/html/features.html#database_file_locking "Please note that this is unsafe as another process is able to open the same database, possibly leading to data corruption"
Probably you should use the 'remote mode'. See http://www.h2database.com/html/features.html#connection_modes Why do you ignore the exceptions? Regards, Thomas On Wed, Apr 8, 2009 at 6:33 PM, sleepycat <[email protected]> wrote: > > in the below code. i have create a table. added some values. > then when i update one row, commit the connection n forcebly end the > program. the update is not visible. > > pls guide me.. > > > /** > * Apr 8, 2009 > */ > > package test; > > import java.sql.Connection; > import java.sql.DriverManager; > import java.sql.Statement; > > /** > * @author sleepycat > * > */ > public class H2 > { > /* > * > */ > /** > * @param args > */ > public static void main(String[] args) > { > try > { > Class.forName("org.h2.Driver"); > Connection connection = DriverManager.getConnection > ("jdbc:h2:file:D:/database/ > datatbl;IGNORECASE=TRUE;LOG=0;LOCK_MODE=3;FILE_LOCK=NO;MVCC=TRUE;CACHE_SIZE=512000"); > Statement statement = connection.createStatement(); > statement.execute("CREATE TABLE DATATBL (KEY > VARCHAR(20),VALUE > VARCHAR(20));"); > statement.execute("INSERT INTO DATATBL > VALUES('ABC','ABC');"); > statement.execute("INSERT INTO DATATBL > VALUES('XYZ','XYZ');"); > statement.execute("INSERT INTO DATATBL > VALUES('ASDF','ASDF');"); > statement.close(); > connection.close(); > > connection = > DriverManager.getConnection("jdbc:h2:file:D:/database/ > datatbl;IGNORECASE=TRUE;LOG=0;LOCK_MODE=3;FILE_LOCK=NO;MVCC=TRUE;CACHE_SIZE=512000"); > statement = connection.createStatement(); > System.out.println(statement.executeUpdate("UPDATE > DATATBL SET > KEY='123' WHERE KEY = 'ABC'")); > connection.commit(); > System.out.println("done forcefull close the program"); > Thread.sleep(10 * 60 * 1000L); > } > catch(Exception exception) > { > ; > } > } > } > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
