java.sql.SQLException: Column not found problem

in following code i want to retreive the maximum serial number from Serial column and return it to caller .

String query;

query ="select MAX(Serial) from CMS..CMSLog";

Statement st = con.createStatement();

ResultSet rs = st.executeQuery(query);

while (rs.next())

{

logserial = rs.getInt("1");

}

rs.close();

con.close();

but i found following exception

java.sql.SQLException: Column not found

so plz help. what to do?

[662 byte] By [@tifa] at [2007-10-3 3:02:07]
# 1
Clearly the column can't be named 'Serial' if you get this error message. I'd find out what it really is named.Brian
brian@cubik.caa at 2007-7-14 20:51:51 > top of Java-index,Java Essentials,New To Java...
# 2
I am doing a dbc app at the moment and using mysql found that the field names were case sensitive. SQL strings failed when I did not match case with the fields in the database.
nerak99a at 2007-7-14 20:51:51 > top of Java-index,Java Essentials,New To Java...
# 3
query = "select MAX(Serial) from CMS..CMSLog";Is your table actually CMS..CMSLog (2 periods?)?.Ted.Message was edited by: ted_trippin - wrong brackets
ted_trippina at 2007-7-14 20:51:51 > top of Java-index,Java Essentials,New To Java...
# 4
Your query doesn't produce a column named "1". If you want the first column from the query, do this:logserial = rs.getInt(1);
DrClapa at 2007-7-14 20:51:51 > top of Java-index,Java Essentials,New To Java...