It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes maximum value of a column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "maximum value of a column" Watch "maximum value of a column" New topic

maximum value of a column

lakshmanan anand

Joined: Jan 13, 2009
Posts: 22

I am trying to add rows to a table (name : csv) whose schema is

ID Name Place
-- ------ --------

ResultSet res = stmt.executeQuery("select max(id) as id from csv");
int i = res.getInt("id");

i want to get the maximum value of ID . when i typed the above code, i get SQLException. what shall i do.
Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 290;
you have to move the resultset to some specific location before doing get operation

I agree. Here's the link:
subject: maximum value of a column
jQuery in Action, 3rd edition