closeOnCompletion

Mark Rotteveel mark at lawinegevaar.nl
Wed Feb 17 12:19:23 UTC 2021


On 2021-02-17 11:53, Dave Cramer wrote:
> Interesting situation.
> 
> If we have an open statement with open resultsets and call
> closeOnCompletion and then execute the statement a second time the
> statement will throw an already closed exception since the spec says 
> that
> executing a statement a second time closes any open resultsets. Closing
> said resultsets ends up closing the statement.
> 
> I'm just confirming that this is the intended behaviour. Seems about 
> right
> since if you set closeOnCompletion you would not expect to re-use the
> statement.

Logically, yes, I think this is how it is supposed to work. If you call 
closeOnCompletion, you signal that you intended to abandon the statement 
after processing, so if you then go and try to use the statement any 
way, you're doing something wrong.

Mark


More information about the jdbc-spec-discuss mailing list