You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by El...@fanuc.de on 2002/06/10 11:50:15 UTC

Re: How many rows have a ResultSet?

Hy,

you can use rs.RecordCount

Regards
Marcus



                                                                                                                
                    "Anibal Constante                                                                           
                    Brito"                  To:     "Tomcat" <to...@jakarta.apache.org>                   
                    <aconstante_00@ho       cc:                                                                 
                    tmail.com>              Subject:     How many rows have a ResultSet?                        
                                                                                                                
                    10.06.2002 11:55                                                                            
                    Please respond to                                                                           
                    "Tomcat Users                                                                               
                    List"                                                                                       
                                                                                                                
                                                                                                                




Hello:

How can I know the rows that have a simple ResultSet, which method or
attribute have to call?

Best Regards.
Owen.

--
To unsubscribe, e-mail:   <
mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:tomcat-user-help@jakarta.apache.org>






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: AW: How many rows have a ResultSet?

Posted by August Detlefsen <au...@yahoo.com>.
LoL @ Oracle. It works great with Postgres!


--- "Power-Netz (Schwarz)" <sc...@power-netz.de> wrote:
> > If you are using JDBC 1.2 you can do it like this (snippet): 
> > 
> > //declare your Statement to return a scroll insensitive result set 
> > //before you make the query
> > stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
> > ResultSet.CONCUR_READ_ONLY);
> > 
> > //get the number of rows by scrolling to the last row, 
> > //getting its number, then returning to the start: 
> > try {
> >     resultSet.last();
> >     numberOfRows = resultSet.getRow();
> >     resultSet.beforeFirst();
> > } catch (Exception e) {
> >     e.printStackTrace();
> > }
> 
> This will only work, IF the underlying driver really supports all
> methods
> offered by JDBC. !this is not for sure! -> see ORACLE who did not
> implement
> all resultset navigation methods.
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <mai��

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


AW: How many rows have a ResultSet?

Posted by "Power-Netz (Schwarz)" <sc...@power-netz.de>.
> If you are using JDBC 1.2 you can do it like this (snippet): 
> 
> //declare your Statement to return a scroll insensitive result set 
> //before you make the query
> stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
> ResultSet.CONCUR_READ_ONLY);
> 
> //get the number of rows by scrolling to the last row, 
> //getting its number, then returning to the start: 
> try {
>     resultSet.last();
>     numberOfRows = resultSet.getRow();
>     resultSet.beforeFirst();
> } catch (Exception e) {
>     e.printStackTrace();
> }

This will only work, IF the underlying driver really supports all methods
offered by JDBC. !this is not for sure! -> see ORACLE who did not implement
all resultset navigation methods.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How many rows have a ResultSet?

Posted by August Detlefsen <au...@yahoo.com>.
Am I correct in assuming you want the number of rows BEFORE you iterate
the result set? 

If you are using JDBC 1.2 you can do it like this (snippet): 

//declare your Statement to return a scroll insensitive result set 
//before you make the query
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);

//get the number of rows by scrolling to the last row, 
//getting its number, then returning to the start: 
try {
    resultSet.last();
    numberOfRows = resultSet.getRow();
    resultSet.beforeFirst();
} catch (Exception e) {
    e.printStackTrace();
}




--- Anibal Constante Brito <ac...@hotmail.com> wrote:
> > Hy,
> >
> > you can use rs.RecordCount
> >
> > Regards
> > Marcus
> 
> the ResultSet don't have this property?, sorry, but you answer don't
> help
> me.
> 
> Owen.
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How many rows have a ResultSet?

Posted by Anibal Constante Brito <ac...@hotmail.com>.
> Hy,
>
> you can use rs.RecordCount
>
> Regards
> Marcus

the ResultSet don't have this property?, sorry, but you answer don't help
me.

Owen.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How many rows have a ResultSet?

Posted by FEDERICO MARTIN LARA <i5...@uco.es>.
In any RDBMS, it don?t work until you have to finished the cursor. It is
true or I'm a mistake?

-----Mensaje original-----
De: Elwert.Marcus@fanuc.de [mailto:Elwert.Marcus@fanuc.de]
Enviado el: lunes, 10 de junio de 2002 11:50
Para: Tomcat Users List
Asunto: Re: How many rows have a ResultSet?



Hy,

you can use rs.RecordCount

Regards
Marcus




                    "Anibal Constante
                    Brito"                  To:     "Tomcat"
<to...@jakarta.apache.org>
                    <aconstante_00@ho       cc:
                    tmail.com>              Subject:     How many rows have
a ResultSet?

                    10.06.2002 11:55
                    Please respond to
                    "Tomcat Users
                    List"






Hello:

How can I know the rows that have a simple ResultSet, which method or
attribute have to call?

Best Regards.
Owen.

--
To unsubscribe, e-mail:   <
mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:tomcat-user-help@jakarta.apache.org>






--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>