Hi Thanks for ur guidance.
I have removed FILE_LOCK=NO from the query. I want to use h2 in embedded mode. But in case of any failure i want the transaction to be durable. i have also tried enableing trace of h2 which shows commit is executed. Cud u pls let me know, how cud i make this transaction durable? Thanks On Apr 9, 12:35 am, Thomas Mueller <[email protected]> wrote: > 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'. > Seehttp://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,committhe 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) > > { > > ; > > } > > } > > }- 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 -~----------~----~----~----~------~----~------~--~---
