Java – is resultset thread safe
Is resultset thread safe?
My problem arises because in my program, I have used different statements for each query. I have declared the resultset as a local variable, but it gives an impermissible operation error after the resultset is closed But my statement is working because I'm using insert and delete statements in queries I have commented on the resultset section and got no errors!
Solution
The real problem is that you share statement objects between multiple threads Each time you "execute" a statement, the previously returned resultset will close automatically In this case, the resultset object "belongs" to other threads that may not have used it So the exception is
You should not share connection, statement / Preparedstatement or resultset objects between multiple threads Each thread should acquire and release its own resources