Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

aggregate functions in JDBC

Posted on 2000-02-16
2
Medium Priority
?
628 Views
Last Modified: 2006-11-17
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
0
Comment
Question by:rajani_n
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 2526281
what about ?
 rs.getInt(1)
0
 
LVL 4

Accepted Solution

by:
jerch earned 100 total points
ID: 2526287
simply do this

int colOne = rs.getInt(1);

1 is the column index or the column number.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question