Showing posts with label ResultSet. Show all posts
Showing posts with label ResultSet. Show all posts

Wednesday, January 24, 2007

How can you retrieve data from the ResultSet?

JDBC returns results in a ResultSet object, so we need to declare an instance of the class ResultSet to hold our results. The following code demonstrates declaring the ResultSet object rs.

ResultSet rs = stmt.executeQuery(”SELECT COF_NAME, PRICE FROM COFFEES”);
String s = rs.getString(”COF_NAME”);

SOURCE : www.referjava.com