Skip to Content.
Sympa Menu

freetds - Re: Delay closing resultsets

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Stephanie Lewis <slewis AT thinweb.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Delay closing resultsets
  • Date: Sun, 01 Oct 2000 11:38:15 -0300


When you query the database, the result set is returned in a
DataInputStream as
packets that are processed as needed (ie: calls to next()). If you close the
result
set before the end of the data is returned, the DataInputStream may still
have data
from the query left in it. The driver uses connection pooling to improve the
efficiency of the driver. So , after you've called close() on the result set,
the
driver wants to put the this connection (really just a socket right), back
into the
pool to be used by another query. Now if you perform another query using the
same
socket, when you start reading the results, you are actually going to start
reading
what was left from the last query before you get to the data you want. It is
for this
reason that the DataInputStream is "flushed" when a result set is closed.
This is what
you've observed as : "it looks like the freetds jdbc driver continues to
fetch all
rows when I close it" .
That's it in a nutshell. I would like for it not to do this as well, but
can't
think of a way yet to solve it without getting rid of the pooling and using a
new
connection every time. Then you could just close the socket on close(). I
think this
would be just trading one performance problem for another though.
Establishing a
connection is costly, hence the pooling. I haven't tried it yet though.
I may have missed some glaring issue, so if I've misunderstood the
process, input
from anyone interested would be appreciated.

Cheers,
Stephanie




Fernando Lozano wrote:

> Hi there!
>
> I am using the freetds jdbc driver for an application that queries
> MS SQL Server 7 on a WAN. My application requires searches that
> returns thousands of rows such as like 'name%' queries.
>
> Most of the time my users will see the first dozens of rows and then
> quit to a more refined search, but it looks like the freetds jdbc
> driver conties to fetch all rows when I close it. The result is a
> big delay (which can be of several minutes) when the user wants to
> try another search. Using Connection.cancel() has the same result.
>
> Is this a bug of the driver, some feature not yet implemented, or
> what? The only workaround I got so far is to call
> Statement.setMaxRows(), but this way the user won't be able to see
> all results, and this is not desirable.
>
> Any hints will be very apreciated.
>
> []s, Fernando Lozano
>
> ---
> You are currently subscribed to freetds as: [slewis AT thinweb.com]
> To unsubscribe, forward this message to $subst('Email.Unsub')




  • Re: Delay closing resultsets, Stephanie Lewis, 10/01/2000

Archive powered by MHonArc 2.6.24.

Top of Page