Solved

aggregate functions in JDBC

Posted on 2000-02-16
2
612 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
changeXy challenge 13 58
mapShare challenge 13 69
HashMap Vs TreeMap 12 49
backtracking recursion  code 19 41
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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 if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now