2 ms·
Or the Java SQL connection interface, that can throw SQLException on close(). Yes, if your connection throws an error when closing, I guess it stops being usabl
by marcosdumay 2y ago
Or the Java SQL connection interface, that can throw SQLException on close(). Yes, if your connection throws an error when closing, I guess it stops being usable.
Has anybody ever did something useful with that exception?
- lxgr 2y agoDepending on the durability guarantees of the database/connection in question and whether it uses request pipelining, I could imagine it indicating something like "non-clean connection shutdown; your last few commands might not have been processed"? There's a similar situation in raw socket programming in some OSes: You might be done writing all your outbound data into the socket (i.e. your last write() call returned indicating success), but the receiving application might crash before being able to read all of your data. By implementing an application-level shutdown command that the other side acknowledges, that can be avoided; maybe some SQL protocol implementations do that, and that exception is thrown if the shutdown request is never acknowledged.