Solved

aggregate functions in JDBC

Posted on 2000-02-16
2
619 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
2 Comments
 
LVL 16

Expert Comment

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

Accepted Solution

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

int colOne = rs.getInt(1);

1 is the column index or the column number.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 74
Problem to Alipay 10 67
Is there a simpler dropbox system? 10 44
How to fix  socket closed error 11 24
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn different types of Android Layout and some basics of an Android App.
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:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

735 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