Skip to Content.
Sympa Menu

freetds - FreeTDS JDBC problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Craig Spannring <Craig.Spannring AT aedinc.net>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: FreeTDS JDBC problem
  • Date: Tue, 21 Sep 1999 11:43:48 -0600 (MDT)




Andreas Tille writes:

> ResultSet rs1, rs2;
> Statement stmt = con.createStatement();
>
> rs1 = stmt.executeQuery(query1);
> if ( rs1.next() ) { ... }
> rs2 = stmt.executeQuery(query2);
^^^^^^^^^^^^
The executeQuery method closes the previous result set, in this case
rs1. From the JDBC documentation-

A ResultSet is automatically closed by the Statement that
generated it when that Statement is closed, re-executed, or is
used to retrieve the next result from a sequence of multiple
results.

You only get one result set per statement. If you need more you'll
have to have multiple statements. The FreeTDS driver allows you to
have as many statements per connection as your database will allow.


> if ( rs2.next() ) { ... }
>
> while ( rs1.next() ) { ... }
^^^^^^^^
The driver should have thrown an SQLException. It does now. The bug
fix is checked into the CVS tree and should be in the next snapshot on
ftp://freetds.internetcds.com/pub/freetds_jdbc



--
=======================================================================
Life is short. | Craig Spannring
Bike hard, ski fast. | Craig.Spannring AT aedinc.net
--------------------------------+------------------------------------
Any sufficiently horrible technology is indistinguishable from Perl.
=======================================================================





Archive powered by MHonArc 2.6.24.

Top of Page