Subject Re: [Firebird-Java] Re: InputStream closes when prepared statement is closed.
Author David Jencks
I think if you use explicit transactions (1) will fail in JayBird as
well. With autocommit on the entire result set is fetched and stored
as soon as you execute the query. With explicit transactions records
are fetched in batches on an as-read basis. I don't have much interest
in trying to disable reading streams out of a closed cached result set,
but I strongly recommend you not rely on this behavior since someone
might make the driver spec compliant on principle or we might find a
speed reason to change the behavior.

david jencks

On Wednesday, January 29, 2003, at 08:32 AM, rajsubramani
<rajsubramani@...> wrote:

> --- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy
> <rrokytskyy@y...>" <rrokytskyy@y...> wrote:
>>> Your mention of interclient is was the missing piece of info from
>>> your first pots. Interclient has been superceed by the type4
>>> Jaybird driver, so if you problem does turn out to be an issue with
>>> Interclient, it is unlikly to be fixed.
>>>
>>> Have you tried you code with the Jaybird driver?
>>
>> JayBird should work the same in this case. If it does not, it will be
>> fixed soon :)
>>
>> Best regards,
>> Roman Rokytskyy
>
>
> Here are the results of the test harness.
> Jaybird succeeds where Interclient fails.
> In light of the above, posting will Jaybird continue to operate like
> this (i.e keep the stream open) or will it be "fixed" to mimic
> Interclient (i.e close the stream)?
>
> Cheers
> -raj
>
>
> -------------------------Test Harness-------------------------
> Case I:
> -------
> PreparedStatement pstmnt = con.prepareStatement("select image from Foo
> where image_id = 1");
> InputStream is = null;
> ResultSet rs = pstmnt.executeQuery();
> while (rs.next())
> {
> is = rs.getBinaryStream("image");
> }
> rs.close();
> pstmnt.close();
>
> //code to extract image object
>
>
> Case II:
> --------
> PreparedStatement pstmnt = con.prepareStatement("select image from Foo
> where image_id = 1");
> InputStream is = null;
> ResultSet rs = pstmnt.executeQuery();
> while (rs.next())
> {
> is = rs.getBinaryStream("image");
> }
> //code to extract image object
> rs.close();
> pstmnt.close();
>
>
> -------------------------Results-------------------------
>
>
> Interclient (for jdk1.3)
> ------------------------
> /**
> * db.driver=interbase.interclient.Driver
> * db.url=jdbc:interbase://<ip address>//<db url>
> * db.user=SYSDBA
> * db.password=masterkey
> */
> CaseI:
> ------
> interbase.interclient.BlobIOException: JDBC IOException: Invalid
> operation to read on closed blob stream.
> See API reference for exception interbase.interclient.BlobIOException
> ...
> ...
>
>
> Case II:
> --------
> Success.
>
>
>
>
> FirebirdSQL-1.0.0RC2
> --------------------
> /**
> * db.driver=org.firebirdsql.jdbc.FBDriver
> * db.url=jdbc:firebirdsql://<ip address>//<db url>
> * db.user=SYSDBA
> * db.password=masterkey
> */
>
> CaseI:
> ------
> Success.
>
>
> Case II:
> --------
> Success.
>
>
>
>
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>