how to retrieve number of rows of a table by jdbc?

can anyone show me a simple snippet of a java code about how to retrieve the number of ROWS in a table?or even only showing the jdbc command that does this job would be enough.thanks in advance :)cheers
[237 byte] By [yilmazay] at [2007-9-26 2:25:35]
# 1

1. query for the count, then execute the query

"select count(*) from test"then

"select * from test"

2. create a scrollable ResultSet then

rs.last();

int count = rs.getRow();

rs.beforeFirst();

Jamie

p.s. this topic has been discussed MANY times. Do a search on this forum and you will get lots of other discussions on this topic.

jlrober at 2007-6-29 9:36:55 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...