Hello to all, 
this is the part of code that locks the table:

public void des(String id, String far) throws Exception {
 Connection conn=SingletonConnection.getConnection();

PreparedStatement ps3=conn.prepareStatement("DELETE FROM TABLE WHERE 
FK_ID=? AND FK_COD=? ");

ps3.setString(1, id);
ps3.setString(2, far);

 *int i = ps3.executeUpdate();*

* if(i==0){ *
*                         //ERROR IS HERE*
* SingletonConnection.closeConnection();*
* throw new Exception("ERROR 505"); *
* }*
conn.commit();
SingletonConnection.closeConnection();

} 

---------------------------

*CODE SingletonConnection :*
---------------------
public class SingletonConnection {
 private static Connection conn;
 private SingletonConnection() throws Exception {

Class.forName("org.h2.Driver"); 
conn = DriverManager.getConnection("jdbc:h2:tcp://localhost/~/FAR", 
"admin", "admin");
conn.setAutoCommit(false);
}
 public static Connection getConnection() throws Exception {
if (conn==null) new SingletonConnection();
 return conn;
}
        public static void closeConnection() throws Exception {
conn=null;
}

}
--------------------------------------

When " int i = ps3.executeUpdate(); " returns  0 , I get this error:

model.exceptions.SchedaException: org.h2.jdbc.JdbcSQLException: Timeout 
trying to lock table "TABLE"; SQL statement:
SELECT * FROM  TABLE

Some suggestion ? Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to