int recc = 0;
private long getRecordCount( Connection db, String sqlRequest )
{
long recc = -1;
try
 {
    Statement s = db.createStatement();
    ResultSet rs = s.executeQuery(sqlRequest);
    // here will be every time one row
    recc = rsCount.getLong(1);
    rs.close();
    s.close();
 }
catch (SQLException e)
{
    return (-1);
}
return (recc);
}

On SQL servers is this method more fast than record-looping because here is
not record transfer and servers are optimized for this type of requests.

L.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to