Re: getGeneratedKeys returns an empty ResultSet
Posted in 2016
Thanks, Ulf. It took a while on our side to resolve the issue, but a fix is currently in testing. First, as to version, we're using Informix Version 11.70.FC7W2X5 (I think that may be a custom installation). Unfortunately, the DBAs told me that upgrading was NOT an option. Second, it was not random; it was happening only on Saturdays (with < 1% on other days of the week), as the data over the last 6 months shows. As it happens, the system load is much lower on Saturdays (store is closed, online orders disabled) and my application is one of the few that use the database on Saturday - most reading is done via an RSS instance. I wondered if that might have something to do with it (some part was sleeping, and not woken up in time to respond). (It is possible that the problem began occurring when we switched to reading from the RSS instance, but I have no (easy) way of checking that now.) As to solutions, at first we considered using a sequence instead of the auto-increment feature. While this was dragging, a member of another team, faced with the same problem, came up with this fix: If the generated key can't be read directly, it can still be read *indirectly* be SELECT'ing the highest request_id. I do have to be careful to avoid race conditions. I'm hoping that limiting the query by order_id, insert time, and other details should be enough to avoid most issues, though browser refresh may be difficult to detect. Thanks for your help. -- Menachem Salomon