I'm stuck trying to capture the output of the SUM SQL command. I have a table called Coins with columns Type, and Value. The exercise asks us to (among other things) use the 'SUM' SQL command to get the sum of the Values column. Here is the section of code that is giving me trouble.
The SimpleDataSource class just provides a convienent method for establishing a connection to the database. I know there is data in the database because the rest of my queries return predictable results. If needed, I could attach my source code. I would be greatful for any tips you can provide.
Thanks, Garrett
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
was returning false, it was that I was trying to provide a column name when I was examining my ResultSet:
This is a snippet from the working code
Thanks for the help. While going back and trying the query you suggested, the light switch just flipped on.
btw I'm using HSQLDB [ February 18, 2006: Message edited by: Garrett Rowe ]
stu derby
Ranch Hand
Joined: Dec 15, 2005
Posts: 333
posted
0
If you'd prefer to get column by name, which is always easier than keeping your indexes straight as the code evolves, most databases/drivers will support this:
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
posted
0
Thanks for the tip stu. That's one that wasn't in my text. That's exactly why I love this forum.