Interface ResultSet

public interface ResultSet extends Object 

SQL queries and many DatabaseMetaData methods return rows of data in ResultSet objects. Such rows must be retrieved in sequence using the ResultSet methods. The next() method is used to scroll through the rows. A ResultSet maintains a cursor pointing to its current row of data. The cursor is initially positioned before the first row. The next method moves the cursor to the next row.

Column values must also be retrieved one by one. The getXXX methods make it possible to access these columns either using the index number of the column or the name of the column (which is case insensitive). Using the column index is the most efficient. Note that the first column is numbered 1. The column values must be retrieved from left to right and only once per column.

See also: executeQuery, getResultSet, ResultSetMetaData

Fields

FETCH_FORWARD

public static final int FETCH_FORWARD

This is a constant for use with setFetchDirection() in order to go forward when fetching results.

FETCH_REVERSE

public static final int FETCH_REVERSE

This is a constant for use with setFetchDirection() in order to go backward when fetching results.

FETCH_UNKNOWN

public static final int FETCH_UNKNOWN

This is a constant for use with setFetchDirection() in order to use the default fetch direction.

TYPE_FORWARD_ONLY

public static final int TYPE_FORWARD_ONLY

This is a constant to specify a move forward cursor.

TYPE_SCROLL_INSENSITIVE

public static final int TYPE_SCROLL_INSENSITIVE

This is a type for a ResultSet object that is scrollable but not sensitive to changes made by others.

TYPE_SCROLL_SENSITIVE

public static final int TYPE_SCROLL_SENSITIVE

This is a type for a ResultSet object that is scrollable and sensitive to changes made by others.

CONCUR_READ_ONLY

public static final int CONCUR_READ_ONLY

This is a concurrency mode for a ResultSet object that can’t be updated.

CONCUR_UPDATABLE

public static final int CONCUR_UPDATABLE

This is a concurrency mode for a ResultSet object that can be updated.

HOLD_CURSORS_OVER_COMMIT

public static final int HOLD_CURSORS_OVER_COMMIT

This indicates that ResultSet objects shouldn’t be closed when the commit is called.

CLOSE_CURSORS_AT_COMMIT

public static final int CLOSE_CURSORS_AT_COMMIT

This indicates that ResultSet objects should be closed at commit time.

Methods

absolute

public boolean absolute(int row) throws SQLException

This moves the cursor to the given row number in the ResultSet object. Negative values are used to position the cursor from the end of the ResultSet.

Parameters:

row:

The number of the row to which the cursor should move

Returns: true if the cursor is on the result set; false otherwise

afterLast

public void afterLast() throws SQLException

This moves the cursor after the last row of the ResultSet object.

beforeFirst

public void beforeFirst() throws SQLException

This moves the cursor before the first row of the ResultSet object.

cancelRowUpdates

public void cancelRowUpdates() throws SQLException

This cancels the updates made to the current row in the ResultSet object. A SQLException is thrown if the cursor is on the insert row.

clearWarnings

public void clearWarnings() throws SQLException

This clears all SQLWarnings. getWarning() returns null after a clearWarning().

close

public void close() throws SQLException

This releases all resources associated with the ResultSet. Normally, a ResultSet is automatically closed by the Statement that generated it when that Statement is closed, reexecuted, or used to retrieve the next result from a sequence of multiple results. The garbage collector also closes ResultSets when they are no longer used.

deleteRow

public void deleteRow() throws SQLException

This deletes the current row from the ResultSet object and from the database. This method cannot be called when the cursor is on the insert row, or a SQLException will be thrown.

findColumn

public int findColumn(String columnName) throws SQLException

This returns the column index from its column name.

Parameters:

columnName:

The name of the column

Returns: The column index

first

public void first() throws SQLException 

This moves the cursor to the first row of the ResultSet object.

getArray

public Array getArray(int columnIndex) throws SQLException

This gets the value of the column as an Array object.

Parameters:

columnIndex:

The column index begins at 1.

Returns: An Array object

getArray

public Array getArray(String columnName) throws SQLException

This gets the value of the column as an Array object.

Parameters:

columnName:

The name of the column

Returns: An Array object

getAsciiStream

public InputStream getAsciiStream(int columnIndex) throws SQLException

This method can be used to retrieve large LONGVARCHAR values. If necessary, the JDBC driver converts the data from database format to ASCII.

Parameters:

columnIndex:

The column index begins at 1.

Returns: A Java input stream; if the value is SQL NULL, the result is null.

getAsciiStream

public InputStream getAsciiStream(String columnName) throws SQLException

This method can be used to retrieve large LONGVARCHAR values. If necessary, the JDBC driver converts the data from database format to ASCII.

Parameters:

columnName:

The name of the column

Returns: A Java input stream; if the value is SQL NULL, the result is null.

getBigDecimal

public BigDecimal getBigDecimal(int columnIndex) throws SQLException

This gets the value of a column as a java.math.BigDecimal object.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is null.

getBigDecimal

public BigDecimal getBigDecimal(String columnName) throws SQLException

This gets the value of a column as a java.math.BigDecimal object.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is null.

getBigDecimal

public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException

This gets the value of a column as a java.math.BigDecimal object.

Parameters:

columnIndex:

The column index begins at 1.

scale:

The number of digits to the right of the decimal.

Returns: The column value; if the value is SQL NULL, the result is null.

getBigDecimal

public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException

This gets the value of a column as a java.math.BigDecimal object.

Parameters:

columnName:

The name of the column

scale:

The number of digits to the right of the decimal point

Returns: The column value; if the value is SQL NULL, the result is null.

getBinaryStream

public InputStream getBinaryStream(int columnIndex) throws SQLException

This method can be used to retrieve large LONGVARBINARY values.

Parameters:

columnIndex:

The column index begins at 1.

Returns: A Java input stream that delivers the database column value as a stream of uninterpreted bytes; if the value is SQL NULL, the result is null.

getBinaryStream

public InputStream getBinaryStream(String columnName) throws SQLException

This method can be used to retrieve large LONGVARBINARY values.

Parameters:

columnName:

The name of the column

Returns: A Java input stream that delivers the database column value as a stream of uninterpreted bytes. If the value is SQL NULL, the result is null.

getBlob

public Blob getBlob(int columnIndex) throws SQLException

This gets the value of the column as a Blob object.

Parameters:

columnIndex:

The column index begins at 1.

Returns: A Blob object

getBlob

public Blob getBlob(String columnName) throws SQLException

This gets the value of the column as a Blob object.

Parameters:

columnName:

The name of the column

Returns: A Blob object

getBoolean

public boolean getBoolean(int columnIndex) throws SQLException

This gets the value of a column as a Java boolean.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is false.

getBoolean

public boolean getBoolean(String columnName) throws SQLException

This gets the value of a column as a Java boolean.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is false.

getByte

public byte getByte(int columnIndex) throws SQLException

This gets the value of a column as a Java byte.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is 0.

getByte

public byte getByte(String columnName) throws SQLException

This gets the value of a column as a Java byte.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is 0.

getBytes

public byte[] getBytes(int columnIndex) throws SQLException

This gets the value of a column as an array of Java bytes representing the raw values returned by the driver.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is null.

getBytes

public byte[] getBytes(String columnName) throws SQLException

This gets the value of a column as an array of Java bytes representing the raw values returned by the driver.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is null.

getCharacterStream

public Reader getCharacterStream(int columnIndex) throws SQLException

This method can be used to retrieve large LONGVARCHAR values.

Parameters:

columnIndex:

The column index begins at 1.

Returns: A Java input stream that delivers the database column value as a stream of characters; if the value is SQL NULL, the result is null.

getCharacterStream

public Reader getCharacterStream(String columnName) throws SQLException

This method can be used to retrieve large LONGVARCHAR values.

Parameters:

columnName:

The name of the column

Returns: A Java input stream that delivers the database column value as a stream of characters; if the value is SQL NULL, the result is null.

getClob

public Clob getClob(int columnIndex) throws SQLException

This gets the value of the column as a Clob object.

Parameters:

columnIndex:

The column index begins at 1.

Returns: A Clob object

getClob

public Clob getClob(String columnName) throws SQLException

This gets the value of the column as a Clob object.

Parameters:

columnName:

The name of the column

Returns: A Clob object

getConcurrency

public int getConcurrency() throws SQLException

This gets the concurrency mode of the ResultSet object.

Returns: One of the following:

  • ResultSet.CONCUR_READ_ONLY

  • ResultSet.CONCUR_UPDATABLE

getCursorName

public String getCursorName() throws SQLException

JDBC supports positioned updates and positioned deletes. This method returns the name of the current SQL cursor used for the ResultSet.

Returns: The ResultSet’s SQL cursor name

getDate

public Date getDate(int columnIndex) throws SQLException

This gets the value of a column as a java.sql.Date object.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is null.

getDate

public Date getDate(String columnName) throws SQLException 

This gets the value of a column as a java.sql.Date object.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is null.

getDate

public Date getDate(int columnIndex, java.util.Calendar cal) throws SQLException

This gets the value of a column as a java.sql.Date object.

Parameters:

columnIndex:

The column index begins at 1.

cal:

The calendar object used to build the date object.

Returns: The column value; if the value is SQL NULL, the result is null.

getDate

public Date getDate(String columnName, java.util.Calendar cal) throws SQLException

This gets the value of a column as a java.sql.Date object.

Parameters:

columnName:

The name of the column

cal:

The calendar object used to build the date object

Returns: The column value; if the value is SQL NULL, the result is null.

getDouble

public double getDouble(int columnIndex) throws SQLException

This gets the value of a column as a Java double.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is 0.

getDouble

public double getDouble(String columnName) throws SQLException 

This gets the value of a column as a Java double.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is 0.

getFetchDirection

public int getFetchDirection() throws SQLException

This returns the fetch direction for the ResultSet object.

Returns: The current fetch direction

getFetchSize

public int getFetchSize() throws SQLException

This gets the fetch size for the ResultSet object.

Returns: The current fetch size

getFloat

public float getFloat(int columnIndex) throws SQLException

This gets the value of a column as a Java float.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is 0.

getFloat

public float getFloat(String columnName) throws SQLException

This gets the value of a column as a Java float.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is 0.

getInt

public int getInt(int columnIndex) throws SQLException 

This gets the value of a column as a Java int.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is 0.

getInt

public int getInt(String columnName) throws SQLException

This gets the value of a column as a Java int.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is 0.

getLong

public long getLong(int columnIndex) throws SQLException

This gets the value of a column as a Java long.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is 0.

getLong

public long getLong(String columnName) throws SQLException

This gets the value of a column as a Java long.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is 0.

getMetaData

public ResultSetMetaData getMetaData() throws SQLException 

A ResultSetMetaData object dynamically provides information regarding a ResultSet. This method returns such an object. It is useful, for example, for getting the number of columns and their types from a ResultSet.

Returns: A ResultSetMetaData object

getObject

public Object getObject(int columnIndex) throws SQLException

This gets the value of a column as a Java object. The type of the Java object is the Java object type corresponding to the column’s SQL type according to standard JDBC type mapping. It can also be used to read database-specific data types.

Parameters:

columnIndex:

The column index begins at 1.

Returns: An Object holding the column value

getObject

public Object getObject(String columnName) throws SQLException

This gets the value of a column as a Java object. The type of the Java object is the Java object type corresponding to the column’s SQL type according to the standard JDBC type mapping. It can also be used to read database-specific data types.

Parameters:

columnName:

The name of the column

Returns: An Object holding the column value

getObject

public Object getObject(int columnIndex, java.util.Map map) throws SQLException

This gets the value of the column as an Object.

Parameters:

columnIndex:

The column index begins at 1.

map:

The type map used to access this column.

Returns: An Object holding the column value

getObject

public Object getObject(String columnName, java.util.Map map) throws SQLException

This gets the value of the column as an Object.

Parameters:

columnName:

The name of the column

map:

The type map used to access this column

Returns: An Object holding the column value

getRef

public Ref getRef(int columnIndex) throws SQLException

This gets the value of the column as a Ref object.

Parameters:

columnIndex:

The index of the column begins at 1.

Returns: A Ref object

getRef

public Ref getRef(String columnName) throws SQLException

This gets the value of the column as a Ref object.

Parameters:

columnName:

The name of the column

Returns: A Ref object

getRow

public int getRow() throws SQLException

This returns the current row number, starting at 1.

Returns: The current row number; 0 if there is no current row

getShort

public short getShort(int columnIndex) throws SQLException

This gets the value of a column as a Java short.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is 0.

getShort

public short getShort(String columnName) throws SQLException

This gets the value of a column as a Java short.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is 0.

getStatement

public Statement getStatement() throws SQLException

This gets the Statement object that produced the ResultSet object.

Returns: The Statement object that produced this ResultSet object or null if there was no Statement.

getString

public String getString(int columnIndex) throws SQLException

This gets the value of a column as a Java String.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is 0.

getString

public String getString(String columnName) throws SQLException

This gets the value of a column as a Java String.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is null.

getTime

public Time getTime(int columnIndex) throws SQLException

This gets the value of a column as a java.sql.Time object.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is null.

getTime

public Time getTime(String columnName) throws SQLException

This gets the value of a column as a java.sql.Time object.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is null.

getTime

public Time getTime(int columnIndex, java.util.Calendar cal) throws SQLException

This gets the value of a column as a java.sql.Time object.

Parameters:

columnIndex:

The column index begins at 1.

cal: The calendar object used to build the date object.

Returns: The column value; if the value is SQL NULL, the result is null.

getTime

public Time getTime(String columnName, java.util.Calendar cal) throws SQLException

This gets the value of a column as a java.sql.Time object.

Parameters:

columnName:

The name of the column

cal:

The calendar object used to build the date object

Returns: The column value; if the value is SQL NULL, the result is null.

getTimestamp

public Timestamp getTimestamp(int columnIndex) throws SQLException

This gets the value of a column as a java.sql.Timestamp object.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value; if the value is SQL NULL, the result is null.

getTimestamp

public Timestamp getTimestamp(String columnName) throws SQLException

This gets the value of a column as a java.sql.Timestamp object.

Parameters:

columnName:

The name of the column

Returns: The column value; if the value is SQL NULL, the result is null.

getTimestamp

public Timestamp getTimestamp(int columnIndex, java.util.Calendar cal) throws SQLException

This gets the value of a column as a java.sql.Timestamp object.

Parameters:

columnIndex:

The column index begins at 1.

cal:

The calendar object used to build the date object.

Returns: The column value; if the value is SQL NULL, the result is null.

getTimestamp

public Timestamp getTimestamp(String columnName, java.util.Calendar cal) throws SQLException

This gets the value of a column as a java.sql.Timestamp object.

Parameters:

columnName:

The name of the column

cal:

The calendar object used to build the date object

Returns: The column value; if the value is SQL NULL, the result is null.

getType

public int getType() throws SQLException

This gets the type of the ResultSet object.

Returns: One of the following:

  • ResultSet.TYPE_FORWARD_ONLY

  • ResultSet.TYPE_SCROLL_INSENSITIVE

  • ResultSet.TYPE_SCROLL_SENSITIVE

getUnicodeStream

public InputStream getUnicodeStream(int columnIndex) throws SQLException

This method can be used to retrieve large LONGVARCHAR values. If necessary, the JDBC driver converts the data from database format to Unicode.

Parameters:

columnIndex:

The column index begins at 1.

Returns: A Java input stream; if the value is SQL NULL, the result is null.

getUnicodeStream

public InputStream getUnicodeStream(String columnName)throws SQLException

This method can be used to retrieve large LONGVARCHAR values. If necessary, the JDBC driver converts the data from database format to Unicode.

Parameters:

columnName:

The name of the column

Returns: A Java input stream representing the column value; if the value is SQL NULL, the result is null.

getURL

public java.net.URL getURL(int columnIndex) throws SQLException, java.net.MalformedURLException

This returns the value of the column in the current row as a java.net.URL object.

Parameters:

columnIndex:

The column index begins at 1.

Returns: The column value as a java.net.URL object or null if the value is SQL NULL

getURL

public java.net.URL getURL(String columnName) throws SQLException, java.net.MalformedURLException

This returns the value of the column in the current row as a java.net.URL object.

Parameters:

columnName:

The column name

Returns: The column value as a java.net.URL object or null if the value is SQL NULL

getWarnings

public SQLWarning getWarnings() throws SQLException

This gets the first warning reported by calls on the current ResultSet. The next warnings are chained to the SQLWarning and are automatically cleared each time a new row is read.

Returns: The first SQLWarning or null

insertRow

public void insertRow() throws SQLException

This inserts the contents of the insert row in the ResultSet object and database. The cursor must be on the insert row when this method is called. A SQLException occurs

if there is a database error, if the cursor isn’t on the insert row, or if values are missing for some columns.

isAfterLast

public boolean isAfterLast() throws SQLException

This checks whether the cursor is after the last row in the ResultSet object.

Returns: true if the cursor is after the last row

isBeforeFirst

public boolean isBeforeFirst() throws SQLException

This checks whether the cursor is before the first row in the ResultSet object.

Returns: true if the cursor is before the first row

isFirst

public boolean isFirst() throws SQLException

This checks whether the cursor is on the first row in the ResultSet object.

Returns: true if the cursor is on the first row

isLast

public boolean isLast() throws SQLException

This checks whether the cursor is on the last row in the ResultSet object.

Returns: true if the cursor is on the last row

last

public void last() throws SQLException

This moves the cursor to the last row of the ResultSet object.

moveToCurrentRow

public void moveToCurrentRow() throws SQLException

This moves the cursor to the remembered cursor position. A SQLException is thrown if a database access error occurs or the result set isn’t updatable.

moveToInsertRow

public void moveToInsertRow() throws SQLException

This moves the cursor to the insert row. A SQLException is thrown if a database access error occurs or the result set isn’t updatable.

next

public boolean next() throws SQLException

This method is used to scan a ResultSet’s rows. The first call to this method makes the first row the current row, the second call makes the second row the current row, and so on. Note that the next() method automatically closes input streams used in conjunction with the getXXXStream() methods and clears the warning chain of the ResultSet.

Returns: true if the new current row is valid; false when there are no more rows

previous

public boolean previous() throws SQLException

This moves the cursor to the previous row in the ResultSet object.

Returns: true if the cursor is on a valid row; false if it is off the result set

refreshRow

public void refreshRow() throws SQLException

This refreshes the current row with its most recent value in the database. This method can’t be called when the cursor is on the insert row, or a SQLException will be thrown.

relative

public boolean relative(int row) throws SQLException

This moves the cursor to a relative number of rows in the ResultSet object. Negative values are used to position backward.

Parameters:

row:

The number of the rows to move from the current row

Returns: true if the cursor is on the result set; false otherwise

rowDeleted

public boolean rowDeleted() throws SQLException

This checks whether a row has been deleted.

Returns: true if a row has been deleted

rowInserted

public boolean rowInserted() throws SQLException

This checks whether the current row has been just inserted.

Returns: true if the row has been inserted

rowUpdated

public boolean rowUpdated() throws SQLException

This checks whether the current row has been updated.

Returns: true if the row has been updated

setFetchDirection

public void setFetchDirection(int direction) throws SQLException

This specifies the direction in which the rows in the ResultSet object will be processed.

Parameters:

direction:

An int specifying one of the following suggested fetch directions:

  • ResultSet.FETCH_FORWARD

  • ResultSet.FETCH_REVERSE

  • ResultSet.FETCH_UNKNOWN

Throws:

SQLException:

If a database access error occurs or the result set type is TYPE_FORWARD_ONLY and the fetch direction isn’t FETCH_FORWARD

setFetchSize

public void setFetchSize(int rows) throws SQLException

This sets the number of rows that should be fetched from the database when more rows are needed for the ResultSet object.

Parameters:

rows:

The number of rows to fetch

updateArray

public void updateArray(int columnIndex, Array x) throws SQLException 

This updates the column with a java.sql.Array value.

Parameters:

columnIndex:

The columnIndex begins at 1.

x:

The new column value.

updateArray

public void updateArray(String columnName, Array x) throws SQLException

This updates the column with a java.sql.Array value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateAsciiStream

public void updateAsciiStream(int columnIndex, java.io.InputStream x,  int length) throws SQLException

This updates the column with an ASCII stream value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

length:

The length of the stream.

updateAsciiStream

public void updateAsciiStream(String columnName, java.io.InputStream x, int length) throws SQLException

This updates the column with an ASCII stream value.

Parameters:

columnName:

The name of the column

x:

The new column value

length:

The length of the stream

updateBigDecimal

public void updateBigDecimal(int columnIndex, java.math.BigDecimal x) throws SQLException

This updates the column with a java.math.BigDecimal value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateBigDecimal

public void updateBigDecimal(String columnName, java.math.BigDecimal x) throws SQLException

This updates the column with a java.sql.BigDecimal value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateBinaryStream

public void updateBinaryStream(int columnIndex, java.io.InputStream x, int length) throws SQLException

This updates the column with a binary stream value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

length:

The length of the stream.

updateBinaryStream

public void updateBinaryStream(String columnName, java.io.InputStream x, int length) throws SQLException

This updates the column with a binary stream value.

Parameters:

columnName:

The name of the column

x:

The new column value

length:

The length of the stream

updateBlob

public void updateBlob(int columnIndex, Blob x) throws SQLException

This updates the column with a java.sql.Blob value.

Parameters:

columnIndex:

The columnIndex begins at 1.

x:

The new column value.

updateBlob

public void updateBlob(String columnName, Blob x) throws SQLException

This updates the column with a java.sql.Blob value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateBoolean

public void updateBoolean(int columnIndex, boolean x) throws SQLException

This updates the column with a boolean value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateBoolean

public void updateBoolean(String columnName, boolean x) throws SQLException

This updates the column with a boolean value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateByte

public void updateByte(int columnIndex, byte x) throws SQLException

This updates the column with a byte value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateByte

public void updateByte(String columnName, byte x) throws SQLException

This updates the column with a byte value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateBytes

public void updateBytes(int columnIndex, byte[] x) throws SQLException

This updates the column with a byte array value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateBytes

public void updateBytes(String columnName, byte[] x) throws SQLException

This updates the column with a byte array value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateCharacterStream

public void updateCharacterStream(int columnIndex, java.io.Reader x, int length) throws SQLException

This updates the column with a character stream value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

length:

The length of the stream.

updateCharacterStream

public void updateCharacterStream(String columnName, java.io.Reader reader, int length) throws SQLException

This updates the column with a character stream value.

Parameters:

columnName:

The name of the column

reader:

The java.io.Reader object containing the new column value

length:

The length of the stream

updateClob

public void updateClob(int columnIndex, Clob x) throws SQLException

This updates the column with a java.sql.Clob value.

Parameters:

columnIndex:

The columnIndex begins at 1.

x:

The new column value.

updateClob

public void updateClob(String columnName, Clob x) throws SQLException

This updates the column with a java.sql.Clob value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateDate

public void updateDate(int columnIndex, Date x) throws SQLException

This updates the column with a java.sql.Date value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateDate

public void updateDate(String columnName, Date x) throws SQLException

This updates the column with a java.sql.Date value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateDouble

public void updateDouble(int columnIndex, double x) throws SQLException

This updates the designated column with a double value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateDouble

public void updateDouble(String columnName, double x) throws SQLException

This updates the column with a double value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateFloat

public void updateFloat(int columnIndex, float x) throws SQLException

This updates the column with a float value.

Parameters:

columnIndex:

The column index begins at 1.

updateFloat

public void updateFloat(String columnName, float x) throws SQLException

This updates the column with a float value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateInt

public void updateInt(int columnIndex, int x) throws SQLException

This updates the column with an int value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateInt

public void updateInt(String columnName, int x) throws SQLException 

This updates the column with an int value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateLong

public void updateLong(int columnIndex, long x) throws SQLException

This updates the column with a long value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateLong

public void updateLong(String columnName, long x) throws SQLException

This updates the column with a long value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateNull

public void updateNull(int columnIndex) throws SQLException

This updates the column with a null value.

Parameters:

columnIndex:

The column index begins at 1.

updateNull

public void updateNull(String columnName) throws SQLException

This updates the column with a null value.

Parameters:

columnName:

The name of the column

updateObject

public void updateObject(int columnIndex, Object x) throws SQLException

This updates the column with an Object value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateObject

public void updateObject(String columnName, Object x) throws SQLException

This updates the column with an Object value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateObject

public void updateObject(int columnIndex, Object x, int scale) throws SQLException

This updates the column with an Object value.

Parameters:

columnIndex: The column index begins at 1.

x:

The new column value.

scale:

The number of digits after the decimal point for the following:

  • java.sql.Types.DECIMAL

  • java.sql.Types.NUMERIC

updateObject

public void updateObject(String columnName, Object x, int scale) throws SQLException

This updates the column with an Object value.

Parameters:

columnName:

The name of the column

x:

The new column value

scale:

The number of digits after the decimal point for the following:

  • java.sql.Types.DECIMAL

  • java.sql.Types.NUMERIC

updateRow

public void updateRow() throws SQLException

This updates the underlying database with the new contents of the current row of the ResultSet object. This method can’t be called when the cursor is on the insert row, or a SQLException will be thrown.

updateRef

public void updateRef(int columnIndex, Ref x) throws SQLException

This updates the column with a java.sql.Ref value.

Parameters:

columnIndex:

The columnIndex begins at 1.

x:

The new column value.

updateRef

public void updateRef(String columnName, Ref x) throws SQLException

This updates the column with a java.sql.Ref value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateShort

public void updateShort(int columnIndex, short x) throws SQLException

This updates the column with a short value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateShort

public void updateShort(String columnName, short x) throws SQLException

This updates the column with a short value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateString

public void updateString(int columnIndex, String x) throws SQLException

This updates the column with a String value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateString

public void updateString(String columnName, String x) throws SQLException

This updates the column with a String value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateTime

public void updateTime(int columnIndex, Time x) throws SQLException

This updates the column with a java.sql.Time value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateTime

public void updateTime(String columnName, Time x) throws SQLException

This updates the column with a java.sql.Time value.

Parameters:

columnName:

The name of the column

x:

The new column value

updateTimestamp

public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException

This updates the column with a java.sql.Timestamp value.

Parameters:

columnIndex:

The column index begins at 1.

x:

The new column value.

updateTimestamp

public void updateTimestamp(String columnName, Timestamp x) throws SQLException 

This updates the column with a java.sql.Timestamp value.

Parameters:

columnName:

The name of the column

x:

The new column value

wasNull

public boolean wasNull() throws SQLException

If a column contains a SQL NULL value, this method returns true. wasNull() can’t be invoked before getting the column’s value with one of the getXXX() methods.

Returns: true if the last column read was SQL NULL



JDBC 3. 0. JAVA Database Connectivity
JDBC 3: Java Database Connectivity
ISBN: 0764548751
EAN: 2147483647
Year: 2002
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net