You're right, once you have accessed the all resultset, it is trash. You
access the data from the list.
Otherwise you have the solution 1, which consists in running the query a
second time but remember the drawback(I am not sure of my english here: ) :
if someone commits any insertion in some tables between the two query, you
will get a different row count!

If you can not deal with that there is the JDBC2 solution but you don't want
it : ). I have the same requirement on the soft I am currently developing.
It is quite easy to develop a ResultSet wrapper class which takes a
resultSet for initialisation and collect everything in an ArrayList and add
a getRowCount method.

a++
----- Original Message -----
From: "Peter Barraud" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 05, 2001 10:47 AM
Subject: RE: recordcount in jdbc 1


> thanx but the problem is that if I do collect the data into a list then
the
> resultset is lost
> so if I want to access the records I will have to access the list.
> Am I right or is there a way to still access the records in the resultset
> peter
>
> -----Original Message-----
> From: Arnaud Hallais [mailto:[EMAIL PROTECTED]]
> Sent: 05 October, 2001 12:35 PM
> To: [EMAIL PROTECTED]
> Subject: Re: recordcount in jdbc 1
>
>
> Hi,
>
> there is no way other than going through the all resultSet to know how
many
> lines are in it.
> So two solutions :
> // solution 1:
> run your query, count the number of lines,re-run your query (to get a
fresh
> resultset), go through it to treat data
> --> problem: if someone commits any new value between the two query run,
> you'll get different row count for the two query
>
> // solution 2:
> run your query, collect data into a dynamic structure like ArrayList or
what
> ever you think is good for you.
> --> problem: this solution can take a lot of memory, but it is always
right
>
> ----- Original Message -----
> From: "Peter Barraud" <[EMAIL PROTECTED]>
> To: "'swing'" <[EMAIL PROTECTED]>
> Sent: Friday, October 05, 2001 5:58 AM
> Subject: recordcount in jdbc 1
>
>
> > Hi,
> > Anybody has any idea of how to get the recordcount of a resultset using
> jdbc
> > 1. Not JDBC 2.
> > Any suggestions would be great
> > _______________________________________________
> > Advanced-swing mailing list
> > [EMAIL PROTECTED]
> > http://eos.dk/mailman/listinfo/advanced-swing
>
> _______________________________________________
> Advanced-swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/advanced-swing
> _______________________________________________
> Advanced-swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/advanced-swing

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to