I want to count the total no of rows in a table

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  Connection con = DriverManager.getConnection("jdbc:odbc:gabbar");
  Statement ps1 = con.createStatement();
  ResultSet count = ps1.executeQuery("SELECT COUNT (*) FROM products );
//products is a table in database

count is of ResultSet type.but i want to do arithmetic operation on count variable.i want count to be in int datatype.what should i do?
i dont know how to solve this problem

I'm looking at the documentation and I don't see a way to "executeScalar" -- which is what I think you're looking for.

One technique you could use is to put that stuff in a function, get the count the hard way and return it as a long. That way, you can use it (by masking it) as a direct result.

Well count any not null column in the table. Then the below code will help u.

if(resultset.next())
long count = Parse to Long (resultset.getString("columnname"));

Use Integer.parseInt() function . It takes String as parameter

use the
int getInt(int columnIndex)
Retrieves the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.

method of ResultSet.