It looks like you could not master your whole life.
try this, you send some vendor specific sql query to DB and lock the tables, then do what ever you want, then unlock them,
MySQL:
String sql = "xxxxxxxxxxxxxxx";
stat.execute("lock tables tableName WRITE"); //shold check the result
rs = stat.executeQuery(sql);
while(rs.next()) {
String sql_in = "update tableName set value=xxx";
another_stat.execute(sql_in);
}
stat.execute("unlock tables");
But I am use weblogic's connection pool,
and my jdbc invoke by ejb, its join ejb's transaction, I think it couldn't set transaction level for self connection.
Add "for update" at the end of that sql can lock that record? if lock how to open that lock? if update fail in later, will it rollback and auto open this lock?