Re: concurrency problem

Поиск
Список
Период
Сортировка
От Aaron Bono
Тема Re: concurrency problem
Дата
Msg-id bf05e51c0606160733s7190a76dq3e4081b82af9d1d@mail.gmail.com
обсуждение исходный текст
Ответ на concurrency problem  ("sathish kumar shanmugavelu" <sathishkumar.shanmugavelu@gmail.com>)
Список pgsql-sql
I know this is a Java issue but I would recommend something more like:

    Statement stmt = con.createStatement();
    try {
       stmt.execute("begin");
       stmt.execute("lock table rcp_patient_visit_monitor");
       psSave.executeUpdate(); //psSave is a prepared statement
       stmt.execute("commit");
       con.commit(); is called
    } catch (Exception e) {
       con.rollback(); is called
    } finally {
       stmt.close();
    }

On 6/16/06, sathish kumar shanmugavelu <sathishkumar.shanmugavelu@gmail.com> wrote:

Dear all,
   I tried the lock table option today.
   yes it works fine when saving simultaneously.
   but after two or three times even when all of us close our application, the lock exists there in the database. when we run the select query from other db tool it hangs up.
 
   our code looks like
       Statement stmt = con.createStatement();
       while(true){
           try{
               stmt.execute("begin");
               stmt.execute("lock table rcp_patient_visit_monitor");
               break;
           }catch(SQLException e){
               stmt.execute("commit"); 
           }
       }
       psSave.executeUpdate(); //psSave is a prepared statement
       stmt.execute("commit");
 
       if saved then
             con.commit(); is called
       if not saved then
             con.rollback(); is called

В списке pgsql-sql по дате отправления:

Предыдущее
От: "Aaron Bono"
Дата:
Сообщение: Re: sessions and prepared statements
Следующее
От: Geoffrey Knauth
Дата:
Сообщение: Re: listen_addresses = '*' ok, specific address(es) no