when does sqlexcepion/virtualmachineerror/outofmemoryerror occur in java?