How do you access the value of an SQL count () query in a Java program

Solution 1:

Use aliases:

SELECT COUNT(*) AS total FROM ..

and then

rs3.getInt("total")

Solution 2:

The answers provided by Bohzo and Brabster will obviously work, but you could also just use:

rs3.getInt(1);

to get the value in the first, and in your case, only column.