setBinaryStream can abandon connection - Mailing list pgsql-jdbc

From Kris Jurka
Subject setBinaryStream can abandon connection
Date
Msg-id Pine.BSO.4.56.0410170735120.16087@leary.csoft.net
Whole thread Raw
Responses Re: setBinaryStream can abandon connection
List pgsql-jdbc
Currently using setBinaryStream over a v3 protocol connection can
completely break your connection if you happen to get the length wrong or
your InputStream throws an Exception the driver will simply close your
connection giving you no chance to rollback.  This patch fixes that by
continuing to pump fake data into the Bind message and simply not issuing
the Execute message.

This isn't ideal because it doesn't actually force a backend error so it
is possible to issue a commit later that will succeed instead of failing,
but I still think it's better than the current behavior.  I suppose we
could deliberately introduce a syntax error or something if in not in
autocommit mode.

Finally do we need a special -1 length argument to tell the driver we
don't know the length.  This will force a copy of the stream instead of
the current direct streaming to the backend, but a memory hog is better
than not working at all.

Kris Jurka

Attachment

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: A solution to the SSL customizing problem
Next
From: Oliver Jowett
Date:
Subject: Re: A solution to the SSL customizing problem