Re: JDBC/informix query
Posted in 1999
Sanjay Sorry about the last email on the same subject. My fingers assumed I was working in vi whereas I was working in Lotus Notes. JDBC supports COMMIT functionality. I am assuming that the SELECT and the UPDATE are separate transactions. In pseudo-code, this is what you would probably need to do: Transaction - select ------------------------------ sql = "select * from ..."; stmt.executeQuery(sql); Transacation - update ---------------------------------- conn.setAutoCommit(false); sql = "update ..."; while (1) { try { stmt.executeUpdate(sql) conn.commit(); } catch (SQLException sqle) { if (sqle.getErrorCode == "record locked sqlcodes") { sleep(1); continue; } else { System.out.println("Update failed " + sqle.getErrorMessage() + "(" + sqle.getErrorCode() + ")"); } } } HTH Sujit SANJAYDIXIT <SANJAYDIXIT@inf.com> on 09/30/99 10:42:09 PM To: informix-list@iiug.org cc: (bcc: Sujit Pal) Subject: JDBC/informix query Hi, We have a requirement where client is a JAVA and backend is informix. There are some server processes as well which will be in ESQL/C. How do I lock informix records thru JDBC and maintain it till the web processing is completed ? Let's take following scenario We query a record thru web and display the contents on the screen. During this, after returning the required data the client disconnects from the server hence the record is not locked. After this if the user updates the details on the screen and tries to update the same record then it may happen that this record is now locked by a ESQL/C server process resulting in failure of the updation. This is very new to me. Please let me know if there is any standard solution available. or should I use softlocks ? Thanks, Sanjay. >