This is the full message error: Caused by: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "TABLE"; SQL statement: SELECT * FROM TABLE [50200-173] at org.h2.message.DbException.getJdbcSQLException(DbException.java:331) at org.h2.message.DbException.get(DbException.java:171) at org.h2.message.DbException.get(DbException.java:148) at org.h2.table.RegularTable.doLock(RegularTable.java:521) at org.h2.table.RegularTable.lock(RegularTable.java:455) at org.h2.table.TableFilter.lock(TableFilter.java:145) at org.h2.table.TableFilter.lock(TableFilter.java:147) at org.h2.command.dml.Select.queryWithoutCache(Select.java:611) at org.h2.command.dml.Query.query(Query.java:314) at org.h2.command.dml.Query.query(Query.java:284) at org.h2.command.dml.Query.query(Query.java:36) at org.h2.command.CommandContainer.query(CommandContainer.java:91) at org.h2.command.Command.executeQuery(Command.java:195) at org.h2.server.TcpServerThread.process(TcpServerThread.java:310) at org.h2.server.TcpServerThread.run(TcpServerThread.java:151) at java.lang.Thread.run(Unknown Source)
at org.h2.engine.SessionRemote.done(SessionRemote.java:579) at org.h2.command.CommandRemote.executeQuery(CommandRemote.java:153) at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:106) ... 39 more Il giorno domenica 4 maggio 2014 10:14:50 UTC+2, Noel Grandin ha scritto: > > Something is wrong with your description because the error message doesn't > match the SQL. Maybe you left part if the message out? > > The short term fix is to increase the lock timeout using the > LOCK_TIMEOUT=123 extension to the URL. > > On Saturday, 3 May 2014, <[email protected] <javascript:>> wrote: > >> 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. >> > -- 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.
