Solved

aggregate functions in JDBC

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What's wrong with this code? 4 47
ejb mdb examples 1 39
Java 8 to Java 6 8 44
Tomcat 9 + java 8 error while trying to deploy a war file 2 859
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

759 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