Ah Brish, good to see you're still here, still pushing your durability
concerns. Enjoy! True durability is for Angels.

sleepycat, Here's a version that seems to work fine for me; I trimmed your
connection urls a bit for clarity, but the main thing is you can't use LOG=0
and expect any durability; the log is what is reprocessed on reconnection
for transactions that were closed dirtily. LOG=2 logs index and data
changes; LOG=1 would probably be sufficient (Thomas correct me if my memory
is faulty). But if you don't LOG, you won't get any changes but those in
perfectly closed transactions. That said, I've seen similar issues in Oracle
and Postgres if you remove all the mechanism that exist for such
interuptions.

Chris

package test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

/**
 * @author sleepycat
 *
 */
public class H2Test
{
    /*
     *
     */
    /**
     * @param args
     */
    public static void main(String[] args)
    {
        try
        {
            Class.forName("org.h2.Driver");
            Connection connection =
DriverManager.getConnection("jdbc:h2:file:c:/datatbl;LOG=2;LOCK_MODE=3;USER=sa");
            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:c:/datatbl;LOG=2;LOCK_MODE=3;USER=sa");
            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)
        {
            exception.printStackTrace();
        }
    }
}

On Thu, Apr 9, 2009 at 9:53 PM, Brish <[email protected]> wrote:

>
> On Apr 9, 1:37 am, sleepycat <[email protected]> wrote:
> > 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.
>
> H2 doesn't support true durability.
>
> Brish
>
> >
>


-- 
C. Schanck

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to