Hello I'm new with H2 I try to execute a simple resultSet.deleteRow()
and it doesn't work. I'm using the h2-1.1.111 version.
Here the test code
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.jdbcx.JdbcConnectionPool;
import org.junit.Test;
public class TestDB {
@Test
public void testRowDelete() throws SQLException {
JdbcConnectionPool cp =
JdbcConnectionPool.create("jdbc:h2:~/test2",
"sa", "");
java.sql.Connection con = cp.getConnection();
Statement stmt = con.createStatement();
stmt.execute("Create Table TEST(ID INT , ID2 INT) ");
stmt.close();
try {
stmt = con.createStatement();
String query = "INSERT INTO TEST VALUES(0, 4)";
for (int i = 0; i < 5; i++) {
query += ",(" + i + ", 3)";
}
stmt.execute(query);
stmt.close();
query = "SELECT * FROM TEST";
stmt =
con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet resultSet = stmt.executeQuery(query);
while (resultSet.next()) {
resultSet.deleteRow();
}
} finally {
stmt = con.createStatement();
stmt.execute("DROP Table TEST");
stmt.close();
}
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---