aggregate functions in JDBC

How do i retrieve the value returned from an aggregate function in JDBC?
For eg.
    rs = executeQuery ("Select Sum(X) from table));
  how do i retrive the value from the resultset? For integer, i have rs.getInt("columnName"). Similary i have for string,date ,etc.

What do i mention in the column name??

TIA.

regards,
Rajani
rajani_nAsked:
Who is Participating?
 
jerchCommented:
simply do this

int colOne = rs.getInt(1);

1 is the column index or the column number.
0
 
heyhey_Commented:
what about ?
 rs.getInt(1)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.