ResultSet reading
In this chapter you will learn:
Viewing a Result Set
The ResultSet
interface contains methods
for getting the data of the current row.
Each data type has its corresponding method in ResultSet
interface.
And each get method has two versions:
- Get by a column name.
- Get by a column index.
For example,
public int getInt(String columnName)
Returns the int in the current row for column named columnNamepublic int getInt(int columnIndex)
Returns the int in the current row for specified column index.
The column index starts at 1, not 0.
The result set maintains a reference to the current row called the cursor.
The cursor is positioned before the first row when a result set is created.
When a result set's next()
method is called, the cursor moves to the first row
of the resultset, and that row becomes the current row.
Next chapter...
What you will learn in the next chapter:
Home » Java Tutorial » Statements, ResultSet, Exception, Warning