Newbie question - getMax?

Hi, I'm a totally green, absolute beginner etc etc JDBC developer.

I have two java programs - the first queries a table with a straightforward select statement, and the second one gets the Max value of a field from a table. Both work wonderfully.

Question is, I need to use the Max value in the first program. I've come across several resources that suggest different ways of doing this but I'm unable to find a good example from which to crib.

The methods I believe I can adopt would be to run a CallableStatement, a PreparedStatement, and I've also found a method getMax. Which would be the best/correct one to use?

I realise that this might seem like a very basic question, but I've been drafted into a project from mainframe world!

Thanks in advance.

[796 byte] By [speedyvespaa] at [2007-11-27 7:05:42]
# 1

Huh?

Figure out what the select statement you would issue to get the information directly from the database.

Create a prepared statement for this query.

Execute the prepared statement, retrieve the result set for the query, and extract the columns you are interested in from the result set.

Without knowing what problems you're encountering I can't be more specific than that.

dcmintera at 2007-7-12 18:56:57 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

> Huh?

>

> Figure out what the select statement you would issue

> to get the information directly from the database.

>

> Create a prepared statement for this query.

>

> Execute the prepared statement, retrieve the result

> set for the query, and extract the columns you are

> interested in from the result set.

>

> Without knowing what problems you're encountering I

> can't be more specific than that.

Yup, I kind of thought that I hadn't formulated the question properly :)

No matter, I think I have the solution. When I find out how to formulate the question, perhaps I'll post that here!

Thanks for looking!

speedyvespaa at 2007-7-12 18:56:57 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...