Podcast
Questions and Answers
Which of the following methods is available in the ResultSet interface?
Which of the following methods is available in the ResultSet interface?
The ArrayList class implementation is a resizable array of objects.
The ArrayList class implementation is a resizable array of objects.
True
What constant indicates that open ResultSet objects will remain open when the current transaction is committed?
What constant indicates that open ResultSet objects will remain open when the current transaction is committed?
HOLD_CURSORS_OVER_COMMIT
What is a feature of the CopyOnWriteArrayList?
What is a feature of the CopyOnWriteArrayList?
Signup and view all the answers
Which of these is an implementation of the Queue interface?
Which of these is an implementation of the Queue interface?
Signup and view all the answers
The method _____ moves the cursor to the end of the ResultSet object.
The method _____ moves the cursor to the end of the ResultSet object.
Signup and view all the answers
Which method is used to clear all warnings reported on a ResultSet object?
Which method is used to clear all warnings reported on a ResultSet object?
Signup and view all the answers
Select the implementations of the BlockingQueue interface.
Select the implementations of the BlockingQueue interface.
Signup and view all the answers
What is the purpose of the FETCH_FORWARD constant?
What is the purpose of the FETCH_FORWARD constant?
Signup and view all the answers
What does the 'pollLast()' method do in the Deque interface?
What does the 'pollLast()' method do in the Deque interface?
Signup and view all the answers
The ConcurrentSkipListSet is a non-scalable navigable set implementation.
The ConcurrentSkipListSet is a non-scalable navigable set implementation.
Signup and view all the answers
Which of the following methods in ResultSet allows moving the cursor to the first row?
Which of the following methods in ResultSet allows moving the cursor to the first row?
Signup and view all the answers
Match the following classes with their descriptions:
Match the following classes with their descriptions:
Signup and view all the answers
What does the method getObject(String columnLabel, Class type)
return?
What does the method getObject(String columnLabel, Class type)
return?
Signup and view all the answers
What is the return type of getArray(int columnIndex)
?
What is the return type of getArray(int columnIndex)
?
Signup and view all the answers
The method getBigDecimal(String columnLabel, int scale)
is still recommended for use.
The method getBigDecimal(String columnLabel, int scale)
is still recommended for use.
Signup and view all the answers
What does the method getDate(int columnIndex)
return?
What does the method getDate(int columnIndex)
return?
Signup and view all the answers
Which method retrieves the current row number?
Which method retrieves the current row number?
Signup and view all the answers
What method would you use to retrieve the first row of a ResultSet object?
What method would you use to retrieve the first row of a ResultSet object?
Signup and view all the answers
What does the method getWarnings()
return?
What does the method getWarnings()
return?
Signup and view all the answers
The method close()
releases the ResultSet object's database resources immediately.
The method close()
releases the ResultSet object's database resources immediately.
Signup and view all the answers
Match the following method signatures with their return types:
Match the following method signatures with their return types:
Signup and view all the answers
The method getString(int columnIndex)
retrieves the value of the designated column as a ______ in Java.
The method getString(int columnIndex)
retrieves the value of the designated column as a ______ in Java.
Signup and view all the answers
What does the method updateBigDecimal(String columnLabel, BigDecimal x)
do?
What does the method updateBigDecimal(String columnLabel, BigDecimal x)
do?
Signup and view all the answers
What is the purpose of updateBinaryStream(String columnLabel, InputStream x)
?
What is the purpose of updateBinaryStream(String columnLabel, InputStream x)
?
Signup and view all the answers
What type of value does updateBlob(String columnLabel, Blob x)
update the designated column with?
What type of value does updateBlob(String columnLabel, Blob x)
update the designated column with?
Signup and view all the answers
What does updateBoolean(String columnLabel, boolean x)
do?
What does updateBoolean(String columnLabel, boolean x)
do?
Signup and view all the answers
What kind of value is updated by updateDate(String columnLabel, Date x)
?
What kind of value is updated by updateDate(String columnLabel, Date x)
?
Signup and view all the answers
What is updated by the method updateFloat(int columnIndex, float x)
?
What is updated by the method updateFloat(int columnIndex, float x)
?
Signup and view all the answers
What does updateNClob(String columnLabel, NClob nClob)
accomplish?
What does updateNClob(String columnLabel, NClob nClob)
accomplish?
Signup and view all the answers
What does updateNull(int columnIndex)
do?
What does updateNull(int columnIndex)
do?
Signup and view all the answers
What is the role of updateTimestamp(String columnLabel, Timestamp x)
?
What is the role of updateTimestamp(String columnLabel, Timestamp x)
?
Signup and view all the answers
Which of the following are types of result set constants? (Select all that apply)
Which of the following are types of result set constants? (Select all that apply)
Signup and view all the answers
The constant FETCH_REVERSE
indicates that rows will be processed from first to last.
The constant FETCH_REVERSE
indicates that rows will be processed from first to last.
Signup and view all the answers
Study Notes
Interface Implementations
- The
Collection
interface has implementations that includeadd
,clear
,addAll
,contains
,containsAll
, andremoveRange
. - The
List
interface has implementations that includeadd
,addAll
,get
,indexOf
,lastIndexOf
,listIterator
,remove
,replaceAll
,sort
, andsubList
. - The
Deque
interface has implementations that includeofferFirst
,offerLast
,peekFirst
,peekLast
,pollFirst
,pollLast
,pop
,push
,removeFirst
,removeFirstOccurrence
,removeLast
,removeLastOccurrence
,addFirst
,addLast
,descendingIterator
,element
,getFirst
, andgetLast
. - The
Queue
interface has implementations that includeelement
,offer
,peek
,poll
, andremove
. - The
Set
interface has implementations that includeofferFirst
,offerLast
,pollFirst
, andpollLast
. - The
Blocking
interface has implementations that includetakeFirst
,takeLast
,putFirst
,putLast
,offerFirst
,offerLast
,pollFirst
, andpollLast
. - The
Blocking
interface also has implementations that includetake
,put
,offer
, andpoll
. - The
NavigableSet
interface includes implementations that includeceiling
,comparator
,descendingIterator
,descendingSet
,floor
,headSet
,higher
,lower
,pollFirst
,pollLast
,subSet
, andtailSet
. - The
SortedSet
interface has implementations that includecomparator
,first
,headSet
,last
,spliterator
,subSet
, andtailSet
.
List Implementations
-
AbstractList
is a skeletal implementation for theList
interface. -
AbstractSequentialList
is a skeletal implementation for theLinkedList
interface. -
ArrayList
is a resizable array that holds objects. -
AttributeList
holds a list of values for anMbean
. -
CopyOnWriteArrayList
is a thread-safe arraylist that copies the underlying array on every modification, making it suitable for use within multiple threads. -
LinkedList
is a doubly linked list that implements theList
and theDeque
interfaces. -
RoleList
is a list ofRole
objects designed for use with relation functions. -
RoleUnresolvedList
is a list ofRoleUnresolved
objects. -
Vector
is a resizable array that holds objects.
Queue Implementations
-
AbstractQueue
is a skeletal implementation for theQueue
interface. -
ArrayBlockingQueue
is a bounded blocking queue. -
ArrayDeque
is a resizable array that implements theDeque
interface. -
ConcurrentLinkedDeque
is a concurrent implementation ofDeque
that is unbounded. -
ConcurrentLinkedQueue
is a concurrent implementation ofQueue
that is unbounded. -
DelayQueue
is an unbounded blocking queue that holds elements that remain in queue until their delay has expired. -
LinkedBlockingQueue
is an optionally bounded blocking deque implemented as linked nodes. -
LinkedBlockingDeque
is an optionally bounded blocking queue implemented as linked nodes. -
LinkedTransferQueue
is an unbounded transfer queue based on linked nodes. -
PriorityBlockingQueue
is an unbounded blocking queue that orders likePriorityQueue
. -
PriorityQueue
is an unbounded priority queue based on the priority heap. -
SynchronousQueue
is a blocking queue each insert operation must wait on a corresponding remove operation by another thread, and vice versa.
Set Implementations
-
AbstractSet
is a skeletal implementation for theSet
interface. -
ConcurrentHashMap.KeySetView
is a concurrentHashMap
as a set of Keys. -
ConcurrentSkipListSet
is a scalable concurrent navigable set. -
CopyOnWriteArraySet
is a thread-safe arraylist in which all mutative operations generate a new copy of the underlying array. -
EnumSet
is a specialized set implementation that works with Enumerations (Enums). -
HashSet
implements theSet
interface, backing by data by a hash table. -
JobStateReasons
is a print attribute class that describes the state of a print job. -
LinkedHashSet
is aLinkedList
implementation of theSet
interface that maintains order without usingTreeSet
. -
TreeSet
is a navigable set implementation based onTreeMap
.
Synchronization
- The
Array
data structure permits nulls, can be aRAD
such as an array, is resizable, is anArrayList
, and is aList
andDeque
with sequential access. -
ArrayList
permits nulls, can be aRAD
, is resizable, and is anArrayList
. -
ArrayList
permits nulls, is aRAD
, is resizable, and is anArrayList
. -
GrowableArray
permits nulls, can be aRAD
, and is resizable. -
BlockingQueue
does not permit nulls, is not aRAD
, is not resizable, and is not aList
,Deque
, orArrayList
. -
Nodes
are resizable. -
Nodes
are not resizable.
JDBC - ResultSet
Constants
-
CLOSE_CURSORS_AT_COMMIT
: Indicates that openResultSet
objects will be closed when the current transaction is committed. -
CONCUR_READ_ONLY
: Indicates that the concurrency mode for aResultSet
object means it cannot be updated. -
CONCUR_UPDATABLE
: Indicates that the concurrency mode for aResultSet
object means it can be updated. -
FETCH_FORWARD
: The constant indicating that the rows in a result set will be processed in a forward direction; first-to-last. -
FETCH_REVERSE
: The constant indicating that the rows in a result set will be processed in a reverse direction; last-to-first. -
FETCH_UNKNOWN
: The constant indicating that the order in which rows in a result set will be processed is unknown. -
HOLD_CURSORS_OVER_COMMIT
: Indicates that openResultSet
objects will remain open when the current transaction is committed. -
TYPE_FORWARD_ONLY
: Indicates the type for aResultSet
object whose cursor may move only forward. -
TYPE_SCROLL_INSENSITIVE
: Indicates the type for aResultSet
object that is scrollable but not generally sensitive to changes to the data that underlies theResultSet
. -
TYPE_SCROLL_SENSITIVE
: Indicates the type for aResultSet
object that is scrollable and generally sensitive to changes to the data that underlies theResultSet
.
Methods
-
afterLast()
: Moves the cursor to the end of theResultSet
object, just after the last row. -
beforeFirstRow()
: Moves the cursor to the front of theResultSet
object, just before the first row. -
cancelRowUpdates()
: Cancels updates made to the current row in thisResultSet
object. -
clearWarnings()
: Clears any warnings reported on thisResultSet
object. -
close()
: Releases the database and JDBC resources for thisResultSet
object immediately. -
deleteRow()
: Deletes the current row from theResultSet
object and from the underlying database. -
findColumn(String columnName)
: Maps the givenResultSet
column label to itsResultSet
column index. -
first()
: Moves the cursor to the first row in thisResultSet
object. -
getConcurrency()
: Retrieves the concurrency mode of thisResultSet
object. -
getCursorName()
: Retrieves the name of the SQL cursor used by thisResultSet
object. -
getFetchDirection()
: Retrieves the fetch direction for thisResultSet
object. -
getFetchSize()
: Retrieves the fetch size for thisResultSet
object. -
getHoldability()
: Retrieves the holdability of thisResultSet
object. -
getMetaData()
: Retrieves the number, types, and properties of thisResultSet
object's columns. -
getRow()
: Retrieves the current row number. -
getType()
: Retrieves the type of thisResultSet
object. -
absolute(int row)
: Moves the cursor to the given row number in thisResultSet
object. -
getArray(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as an Array object. -
getArray(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as an Array object. -
getBigDecimal(int columnIndex, int scale)
: Deprecated. UsegetBigDecimal(int columnIndex)
orgetBigDecimal(String columnLabel)
. -
getBigDecimal(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.math.BigDecimal
with full precision. -
getBigDecimal(String columnLabel, int scale)
: Deprecated. UsegetBigDecimal(int columnIndex)
orgetBigDecimal(String columnLabel)
. -
getBigDecimal(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.math.BigDecimal
with full precision. -
getBinaryStream(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a stream of uninterpreted bytes. -
getBinaryStream(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a stream of uninterpreted bytes. -
getBlob(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aBlob
object. -
getBlob(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aBlob
object. -
getBoolean(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a boolean. -
getBoolean(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a boolean. -
getByte(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a byte. -
getByte(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a byte. -
getBytes(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a byte array. -
getBytes(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a byte array. -
getClob(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aClob
object. -
getClob(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aClob
object. -
getCharacterStream(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a java.io.Reader object. -
getCharacterStream(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a java.io.Reader object. -
getDate(int columnIndex, Calendar cal)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Date
object. -
getDate(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Date
object. -
getDate(String columnLabel, Calendar cal)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Date
object. -
getDate(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Date
object. -
getDouble(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a double. -
getDouble(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a double. -
getFloat(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a float. -
getFloat(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a float. -
getNClob(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aNClob
object. -
getNClob(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aNClob
object. -
getNCharacterStream(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.io.Reader
object. -
getNCharacterStream(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.io.Reader
object. -
getNString(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aString
. -
getNString(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aString
. -
getObject(int columnIndex, Map<String, Class<?>> map)
: Retrieves the value of the designated column in the current row of thisResultSet
object as an object. -
getObject(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as an object. -
getObject(String columnLabel, Map<String, Class<?>> map)
: Retrieves the value of the designated column in the current row of thisResultSet
object as an object. -
getObject(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as an object. -
getRef(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aRef
object. -
getRef(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aRef
object. -
getRowId(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aRowId
object. -
getRowId(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aRowId
object. -
getSQLXML(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aSQLXML
object. -
getSQLXML(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aSQLXML
object. -
getShort(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a short. -
getShort(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as a short. -
getString(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aString
. -
getString(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as aString
. -
getTime(int columnIndex, Calendar cal)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Time
object. -
getTime(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Time
object. -
getTime(String columnLabel, Calendar cal)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Time
object. -
getTime(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Time
object. -
getTimestamp(int columnIndex, Calendar cal)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Timestamp
object. -
getTimestamp(int columnIndex)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Timestamp
object. -
getTimestamp(String columnLabel, Calendar cal)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Timestamp
object. -
getTimestamp(String columnLabel)
: Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.sql.Timestamp
object. -
isAfterLast()
: Indicates whether the cursor is positioned after the last row in thisResultSet
object. -
isBeforeFirst()
: Indicates whether the cursor is positioned before the first row in thisResultSet
object. -
isFirst()
: Indicates whether the cursor is on the first row in thisResultSet
object. -
isLast()
: Indicates whether the cursor is on the last row in thisResultSet
object. -
last()
: Moves the cursor to the last row in thisResultSet
object. -
next()
: Moves the cursor forward one row from its current position. -
previous()
: Moves the cursor backward one row from its current position. -
moveToCurrentRow()
: Moves the cursor to the current row, which is the row that was current when the call toupdateRow
occurred. -
moveToInsertRow()
: Moves the cursor to the insert row. -
refreshRow()
: Updates the current row with the current values in the underlying database. -
relative(int rows)
: Moves the cursor a relative number of rows, either positive or negative. -
rowDeleted()
: Indicates whether the current row has been deleted. -
rowInserted()
: Indicates whether a new row has been inserted. -
rowUpdated()
: Indicates whether the current row has been updated. -
updateArray(int columnIndex, Array x)
: Updates the designated column with a givenArray
object. -
updateArray(String columnLabel, Array x)
: Updates the designated column with a givenArray
object. -
updateAsciiStream(int columnIndex, InputStream x, int length)
: Updates the designated column with a stream of ASCII characters. -
updateAsciiStream(int columnIndex, InputStream x, long length)
: Updates the designated column with a stream of ASCII characters. -
updateAsciiStream(String columnLabel, InputStream x, int length)
: Updates the designated column with a stream of ASCII characters. -
updateAsciiStream(String columnLabel, InputStream x, long length)
: Updates the designated column with a stream of ASCII characters. -
updateBigDecimal(int columnIndex, BigDecimal x)
: Updates the designated column with a givenBigDecimal
object. -
updateBigDecimal(String columnLabel, BigDecimal x)
: Updates the designated column with a givenBigDecimal
object. -
updateBinaryStream(int columnIndex, InputStream x, int length)
: Updates the designated column with a stream of uninterpreted bytes. -
updateBinaryStream(int columnIndex, InputStream x, long length)
: Updates the designated column with a stream of uninterpreted bytes. -
updateBinaryStream(String columnLabel, InputStream x, int length)
: Updates the designated column with a stream of uninterpreted bytes. -
updateBinaryStream(String columnLabel, InputStream x, long length)
: Updates the designated column with a stream of uninterpreted bytes. -
updateBlob(int columnIndex, Blob x)
: Updates the designated column with aBlob
object. -
updateBlob(int columnIndex, InputStream inputStream, long length)
: Updates the designated column with a stream of uninterpreted bytes. -
updateBlob(String columnLabel, Blob x)
: Updates the designated column with aBlob
object. -
updateBlob(String columnLabel, InputStream inputStream, long length)
: Updates the designated column with a stream of uninterpreted bytes. -
updateBoolean(int columnIndex, boolean x)
: Updates the designated column with a given boolean value. -
updateBoolean(String columnLabel, boolean x)
: Updates the designated column with a given boolean value. -
updateByte(int columnIndex, byte x)
: Updates the designated column with a given byte value. -
updateByte(String columnLabel, byte x)
: Updates the designated column with a given byte value. -
updateBytes(int columnIndex, byte[] x)
: Updates the designated column with a given byte array. -
updateBytes(String columnLabel, byte[] x)
: Updates the designated column with a given byte array. -
updateCharacterStream(int columnIndex, Reader x, int length)
: Updates the designated column with a stream of Unicode characters. -
updateCharacterStream(int columnIndex, Reader x, long length)
: Updates the designated column with a stream of Unicode characters. -
updateCharacterStream(String columnLabel, Reader x, int length)
: Updates the designated column with a stream of Unicode characters. -
updateCharacterStream(String columnLabel, Reader x, long length)
: Updates the designated column with a stream of Unicode characters. -
updateClob(int columnIndex, Clob x)
: Updates the designated column with a givenClob
object. -
updateClob(int columnIndex, Reader reader, long length)
: Updates the designated column with a stream of Unicode characters. -
updateClob(String columnLabel, Clob x)
: Updates the designated column with a givenClob
object. -
updateClob(String columnLabel, Reader reader, long length)
: Updates the designated column with a stream of Unicode characters. -
updateDate(int columnIndex, Date x)
: Updates the designated column with a givenjava.sql.Date
object. -
updateDate(String columnLabel, Date x)
: Updates the designated column with a givenjava.sql.Date
object. -
updateDouble(int columnIndex, double x)
: Updates the designated column with a given double value. -
updateDouble(String columnLabel, double x)
: Updates the designated column with a given double value. -
updateFloat(int columnIndex, float x)
: Updates the designated column with a given float value. -
updateFloat(String columnLabel, float x)
: Updates the designated column with a given float value. -
updateInt(int columnIndex, int x)
: Updates the designated column with a given integer value. -
updateInt(String columnLabel, int x)
: Updates the designated column with a given integer value. -
updateLong(int columnIndex, long x)
: Updates the designated column with a given long value. -
updateLong(String columnLabel, long x)
: Updates the designated column with a given long value. -
updateNClob(int columnIndex, NClob x)
: Updates the designated column with a given NClob object. -
updateNClob(int columnIndex, Reader reader, long length)
: Updates the designated column with a stream of Unicode characters. -
updateNClob(String columnLabel, NClob x)
: Updates the designated column with a given NClob object. -
updateNClob(String columnLabel, Reader reader, long length)
: Updates the designated column with a stream of Unicode characters. -
updateNString(int columnIndex, String nString)
: Updates the designated column with a givenString
object. -
updateNString(String columnLabel, String nString)
: Updates the designated column with a givenString
object. -
updateNull(int columnIndex)
: Updates the designated column with the SQLNULL
value. -
updateNull(String columnLabel)
: Updates the designated column with the SQLNULL
value. -
updateObject(int columnIndex, Object x, int scale)
: Updates the designated column with a given object value. -
updateObject(int columnIndex, Object x)
: Updates the designated column with a given object value. -
updateObject(String columnLabel, Object x, int scale)
: Updates the designated column with a given object value. -
updateObject(String columnLabel, Object x)
: Updates the designated column with a given object value. -
updateRef(int columnIndex, Ref x)
: Updates the designated column with a givenRef
object. -
updateRef(String columnLabel, Ref x)
: Updates the designated column with a givenRef
object. -
updateRow()
: Updates the underlying database with the current values in thisResultSet
object. -
updateRowId(int columnIndex, RowId x)
: Updates the designated column with a givenRowId
object. -
updateRowId(String columnLabel, RowId x)
: Updates the designated column with a givenRowId
object. -
updateSQLXML(int columnIndex, SQLXML xmlObject)
: Updates the designated column with a givenSQLXML
object. -
updateSQLXML(String columnLabel, SQLXML xmlObject)
: Updates the designated column with a givenSQLXML
object. -
updateShort(int columnIndex, short x)
: Updates the designated column with a given short value. -
updateShort(String columnLabel, short x)
: Updates the designated column with a given short value. -
updateString(int columnIndex, String x)
: Updates the designated column with a givenString
object. -
updateString(String columnLabel, String x)
: Updates the designated column with a givenString
object. -
updateTime(int columnIndex, Time x)
: Updates the designated column with a givenjava.sql.Time
object. -
updateTime(String columnLabel, Time x)
: Updates the designated column with a givenjava.sql.Time
object. -
updateTimestamp(int columnIndex, Timestamp x)
: Updates the designated column with a givenjava.sql.Timestamp
object. -
updateTimestamp(String columnLabel, Timestamp x)
: Updates the designated column with a givenjava.sql.Timestamp
object. -
wasNull()
: Indicates whether the last column read had a value of SQLNULL
.
ResultSet
Methods
-
ResultSet
is a database result set, which can be manipulated and queried using its various methods. AResultSet
can be retrieved from aStatement
object. - All methods take either a
String
column label or anint
column index as an argument. - The
columnLabel
is the name of the column, while thecolumnIndex
is the position of the column in theResultSet
object, starting at 1. -
getBoolean()
,getByte()
,getShort()
,getInt()
,getLong()
,getFloat()
,getDouble()
,getString()
andgetBigDecimal()
can return an object of the corresponding type, if the column data type is convertible to that type. -
getArray()
,getBlob()
,getClob()
,getNClob()
,getRef()
,getRowId()
,getSQLXML()
andgetObject()
are used to retrieve columns as their respective types. -
getDate()
,getTime()
andgetTimestamp()
can convert the column value to a java.sql.Date, java.sql.Time, or java.sql.Timestamp object, if possible. -
getAsciiStream()
,getBinaryStream()
,getCharacterStream()
andgetNCharacterStream()
retrieve data as input streams of characters or bytes. -
getObject(String columnLabel, Class type)
andgetObject(int columnIndex, Class type)
can convert retrieved data into the requested Java data type. -
updateObject()
is used to update the current row with a specified object. -
updateXXX()
methods allow updating a column with a specific data type.
ResultSet
Properties
-
getConcurrency()
returns the concurrency mode of theResultSet
object. -
getFetchDirection()
returns the current fetch direction of theResultSet
object. -
getFetchSize()
returns the number of rows fetched from the database at a time. -
getHoldability()
returns the holdability of theResultSet
object. -
getMetaData()
retrieves theResultSetMetaData
object which contains meta information about theResultSet
columns. -
getStatement()
returns theStatement
object associated with thisResultSet
. -
getType()
returns the type of theResultSet
object, such asResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
.
Navigation Methods
-
afterLast()
moves the cursor to the end of theResultSet
, after the last row. -
beforeFirst()
moves the cursor to the beginning of theResultSet
, before the first row. -
first()
moves the cursor to the first row of theResultSet
. -
last()
moves the cursor to the last row of theResultSet
. -
next()
moves the cursor to the next row of theResultSet
. -
previous()
moves the cursor to the previous row of theResultSet
. -
absolute(int row)
moves the cursor to the specified row number. -
relative(int rows)
moves the cursor a relative number of rows (positive or negative). -
rowDeleted()
,rowInserted()
androwUpdated()
indicate if the current row has been deleted, inserted or updated.
Others
-
close()
closes theResultSet
and releases its resources. -
cancelRowUpdates()
cancels any updates made to the current row. -
deleteRow()
removes the current row. -
insertRow()
inserts the contents of the insert row into theResultSet
and the database. -
moveToCurrentRow()
moves the cursor back to its original position. -
moveToInsertRow()
moves the cursor to the insertion row, where data can be inserted. -
refreshRow()
updates the current row with its most recent data from the database table. -
setFetchDirection(int direction)
sets the fetch direction of theResultSet
object. -
setFetchSize(int rows)
sets the number of rows to be fetched at a time. -
getCursorName()
retrieves the name of the SQL cursor used by theResultSet
. -
getWarnings()
retrieves the first warning reported by theResultSet
object. -
clearWarnings()
clears all warnings reported by theResultSet
object. -
wasNull()
returns a boolean value indicating whether the previously retrieved value was null.
Update Methods
-
updateBlob
methods update a designated column (specified by column name or index) with aBlob
value. -
updateBoolean
methods update a designated column with aboolean
value. -
updateByte
methods update a designated column with abyte
value. -
updateBytes
methods update a designated column with abyte[]
value. -
updateCharacterStream
methods update a designated column with aReader
object, streaming characters. It can optionally take alength
parameter to specify the number of characters to read. -
updateClob
methods update a designated column with aClob
value. It can also take aReader
object to stream characters. -
updateDate
methods update a designated column with aDate
value. -
updateDouble
methods update a designated column with adouble
value. -
updateFloat
methods update a designated column with afloat
value. -
updateInt
methods update a designated column with anint
value. -
updateLong
methods update a designated column with along
value. -
updateNCharacterStream
methods update a designated column with aReader
object, streaming characters in the national character set. It can optionally take alength
parameter to specify the number of characters to read. -
updateNClob
methods update a designated column with anNClob
value. It also accepts aReader
object for streaming characters in the national character set. -
updateNString
methods update a designated column with a String value in the national character set. -
updateNull
methods sets the designated column to a null value. -
updateObject
methods update a designated column with a genericObject
value. It can also take ascaleOrLength
parameter to specify the precision of the value. -
updateRef
methods update a designated column with aRef
value, representing a reference to a database object. -
updateRow
updates the underlying database with the new contents of the current row in theResultSet
. -
updateRowId
methods update a designated column with aRowId
value, representing a unique identifier for a row in the database. -
updateSQLXML
methods update a designated column with aSQLXML
value, representing an XML document. -
updateShort
methods update a designated column with ashort
value. -
updateString
methods update a column with aString
value. -
updateTime
methods update a designated column with aTime
value. -
updateTimestamp
methods update a designated column with aTimestamp
value. It can optionally take aCalendar
object for specifying a timezone.
ResultSet
Constants
-
CLOSE_CURSORS_AT_COMMIT
: Indicates that openResultSet
objects will be closed when the transaction is committed. -
CONCUR_READ_ONLY
: Indicates that theResultSet
is read-only and cannot be updated. -
CONCUR_UPDATABLE
: Indicates that theResultSet
is updatable. -
FETCH_FORWARD
: Indicates that theResultSet
is processed in forward direction, from the first row to the last row. -
FETCH_REVERSE
: Indicates that theResultSet
is processed in reverse direction, from the last row to the first row. -
FETCH_UNKNOWN
: Indicates that the order of row processing is unknown. -
HOLD_CURSORS_OVER_COMMIT
: Indicates that openResultSet
objects will remain open when the transaction is committed. -
TYPE_FORWARD_ONLY
: Indicates that the cursor of theResultSet
can only move forward. -
TYPE_SCROLL_INSENSITIVE
: Indicates that theResultSet
is scrollable, but not sensitive to changes in the underlying data. -
TYPE_SCROLL_SENSITIVE
: Indicates that theResultSet
is scrollable and sensitive to changes in the underlying data.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
This quiz covers the various implementations of Java collection interfaces including Collection, List, Deque, Queue, Set, and Blocking. Assess your understanding of methods like add, remove, and peek among others fundamental to Java collections.