db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hawkx <ha...@163.com>
Subject Why derby do not auto commit?
Date Mon, 31 May 2010 04:03:35 GMT

I found that derby do not auto commit data change on my computer, even I set
auto commit to true explicitly. nothing written to database, unless I call
commit().

java version "1.6.0_19"
Java(TM) SE Runtime Environment (build 1.6.0_19-b04)
Java HotSpot(TM) Client VM (build 16.2-b04, mixed mode, sharing)
derby 10.6.1 embedded driver

Code:
    Connection con =
DriverManager.getConnection("jdbc:derby:D:/test/testdb");
//    con.setAutoCommit(true);
    Statement stm = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
    ResultSet rst = stm.executeQuery("SELECT * FROM test_table");
    rst.moveToInsertRow();
    rst.updateString(1, "test line");
    rst.insertRow();
    rst.beforeFirst();
    while (rst.next()) {
      System.out.println(rst.getString(1));
    }
    System.out.println(con.getAutoCommit());
//    con.commit();
    con.close();

-- 
View this message in context: http://old.nabble.com/Why-derby-do-not-auto-commit--tp28726531p28726531.html
Sent from the Apache Derby Developers mailing list archive at Nabble.com.


Mime
View raw message