JDBC API NUTSHELL


java.sql package

Interface:

 
Connection Statement PreparedStatement
CallableStatement ResultSet Array:
Blob:  Clob  Ref: 


Connection:

Denotes a session with the database. A connection's database can provide informations describing about its tables, its supported SQL Grammar, it stored procedures, the capabilities for this connection and so on. This is obtained by calling the getMetaData method.
A Connection has auto-commit enabled by default.

Static fields:

The fields of the Connection Inteface are static int fields that determines different transaction isolation levels.


Methods:

Statement:
Represents an object that is used to execute a  static SQL statement. Only one ResultSet can be open for a statement at any point of time. All of Statement's execute method closes any open ResulSet if open.

Methods:

public ResultSet executeQuery(String sql) throws SQLException
Executes a SQL statement that returns a single ResultSet.

public int executeUpdate(String sql) throws SQLException
Executes an UPDATE, INSERT OR DELETE statement and returns the count of the rows it affected. It is also used to execute SQL DDL statements that return nothing, in which case the method returns 0.

public void close() throws SQLException
Releases this Statement Object's database and JDBC resources as soon as possible rather than waiting it to be released automatically when the object is garbage collected.

public int getMaxFieldSize() throws SQLException
Return the maximum number of bytes any column can have. It applies to only BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. If the maximum is exceeded then the excess data is silently discarded. Zero means unlimited.

public void setMaxFieldSize(int size) throws SQLException
Sets the maximum number of bytes for columns. A zero value means unlimited.

public int getMaxRows() throws SQLException
Returns the maximum number of rows a ResultSet object can hold. The excess rows are silently discarded.
Zero means unlimited.

public void setMaxRows(int max) throws SQLException
Sets the maximum number of rows a ResultSet object can have. A zero value means unlimited.

public void setEscapeProcessing(boolean enable) throws SQLException
By default escape processing is enabled. If enabled, the driver will do escape substitution before sending the SQL to the database.

public int getQueryTimeout() throws SQLException
The number of seconds the driver will wait to complete a statement to execute. If the limit is exceeded then an SQLException is thrown.

public void setQueryTimeout() throws SQLException
Sets the number of seconds the driver will wait for a statement to complete execution.

public void cancel() throws SQLException
If the DBMS and the Driver supports SQL execution abortion, this method can be used to cancel this statement. The method can be used by a Thread to cancel  a statement that is being executed by another Thread.

public SQLWarning getWarnings() throws SQLException
Get the first warning of this statement. All other warnings are chained to the first warning. Whenever the statement is reexecuted all the warnings get cleared.

public void clearWarnings() throws SQLException
Clear all warnings reported to this statement.

public void setCursorName(String name) throws SQLException
This sets the name of the cursor that is associated with this Statement object. The cursor name then be used to identify the row in the ResultSet to be used in positioned updates/deletes. The Driver may not support positioned update/delete operation in which case this method is a NOOP. For positioned update/delete the query of the ResultSet must have been created by using the "select ... for update" SQL.

As a general rule a cursor name must be unique within a connection. Also the SQL to do positioned update/delete is done from a different statement.

public boolean execute(String sql) throws SQLException
Used to execute a single SQL statement that can return more than one result. Say multiple resultSets and/or update counts. Such a situation can happen while calling a stored procedure that returns more than one result.
The method returns true if the first result is a ResultSet and false it the first result is an update count or there was no result.
getResultSet(), getUpdateCount() are used to get the resultSet and update counts. While getMoreResults() moves to any subsequent results.

public ResultSet getResultSet() throws SQLException
Returns the next result as a ResultSet. This method needs to be called only once for each result.
Returns null if the current result was an update count or there was no result.

public int getUpdateCount() throws SQLException
Returns the current result as an update count. If the current result is a ResultSet or there was no result the method returns -1. This method should be called only once per result.

public boolean getMoreResults() throws SQLException
Moves to the next result. Returns true if the next result is a ResultSet else false.
There are no more result when (!getMoreResults() && getUpdateCount()== -1) is true.

public void setFetchDirection(int direction) throws SQLException
This methods sets the direction in which the rows in ResultSets produced by this statement will be processed. The resultSet can in turn set it own direction also.
The argument should be one of the 3 constants: ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, ResultSet.FETCH_UNKNOWN.

public int getFetchDirection() throws SQLException
Returns the fetch direction of results sets generated by this statement.

public void setFetchSize(int size) throws SQLException
Sets as a hint to the Driver as to how many rows must be fetch when needed.
The argument should have a value between 0 and getMaxRows().

public int getFetchSize() throws SQLException
Returns the fetch size of this statement.

public int getResultSetConcurrency() throws SQLException
Returns the concurrency mode for resultSets returned by this statement.

public int getResultSetType() throws SQLException
Returns the resultSet type for result sets returned by this statement.

public void addBatch(String sql) throws SQLException
Adds the SQL to the current batch of commands for this statement.

public void clearBatch() throws SQLException
Clears all the commands from the current batch of this statement.

public int[] executeBatch() throws SQLException
Executes the current batch of commands of this statement. The method returns an array of update counts containing on element for each command in the batch and ordered according to the order they were entered into the batch.

public Connection getConnection() throws SQLException
Get the connection associated with this statement.


PreparedStatement:
A subclass of Statement which represents a pre-compiled SQL statement.

Methods exclusive to PreparedStatement:

public void setNull(int parameterIndex, int sqlType) throws SQLException
Set the specified IN parameter to SQL NULL. The first parameter is the index of the IN parameter starting from 1. The second argument specifies the java.sql. Type.

public void setByte(int parameterIndex, byte val) throws SQLException
Sets the specified IN paramter to the byte value. The driver will convert this to SQL TINYINT while sending to the database.

public void setShort(int parameterIndex, short  val) throws SQLException
Sets the specified IN paramter to the short value. The driver will convert this to SQL SMALLINT while sending to the database.

public void setInt(int parameterIndex, int val) throws SQLException
Sets the specified IN paramter to the int value. The driver will convert this to SQL INTEGER while sending to the database.

public void setLong(int parameterIndex, long val) throws SQLException
Sets the specified IN paramter to the long value. The driver will convert this to SQL BIGINT while sending to the database.

public void setFloat(int parameterIndex, float val) throws SQLException
Sets the specified IN paramter to the float value. The driver will convert this to SQL FLOAT while sending to the database.

public void setDouble(int parameterIndex, double val) throws SQLException
Sets the specified IN paramter to the double value. The driver will convert this to SQL DOUBLE while sending to the database.

public void setBigDecimal(int parameterIndex, BigDecimal val) throws SQLException
Sets the specified IN paramter to the BigDecimal value. The driver will convert this to SQL NUMERIC while sending to the database.

public void setString(int parameterIndex, String val) throws SQLException
Sets the specified IN paramter to the String value. The driver will convert this to SQL VARCHAR or LONGVARCHAR depending on the driver's limit on VARCHAR, while sending to the database.

public void setBytes(int parameterIndex, byte[] val) throws SQLException
Sets the specified IN paramter to the byte array. The driver will convert this to SQL VARBINARY or LONGVARBINARY depending on the driver's limit of VARBINARY, while sending to the database.

public void setDate(int parameterIndex, Date val) throws SQLException
Sets the specified IN paramter to the Date value. The driver will convert this to SQL DATE while sending to the database.

public void setTime(int parameterIndex, Time val) throws SQLException
Sets the specified IN paramter to the Time value. The driver will convert this to SQL TIME while sending to the database.

public void setTimestamp(int parameterIndex, Timestamp val) throws SQLException
Sets the specified IN paramter to the Timestamp value. The driver will convert this to SQL TIMESTAMP while sending to the database.

public void setAsciiStream(int parameterIndex, InputStream is, int length) throws SQLException
Sets the specified IN paramter to the InputStream which has got length number of bytes. When very large ASCII value is input to a LONGVARCHAR it is more practical to specify an InputStream from which the data can be read. The driver does the necessary conversion from ASCII to database char format.

public void setUnicodeStream(int parameterIndex, InputStream is, int length) throws SQLException
Sets the specified IN paramter to the InputStream which has got length number of bytes. When very large UNICODE value is input to a LONGVARCHAR it is more practical to specify an InputStream from which the data can be read. The driver does the necessary conversion from Unicode to database char format.

public void setBinaryStream(int parameterIndex, InputStream is, int length) throws SQLException
Sets the specified IN paramter to the InputStream which has got length number of bytes. When very large binary value is input to a LONGVARBINARY it is more practical to specify an InputStream from which the data can be read.

public void clearParameters() throws SQLException
Clear all the values set to the IN parameters.

public void setObject(int parameterIndex, Object obj, int sqlType, int scale) throws SQLException
Sets the value of the specified IN parameter to the value of the object. sqlType is the type of the SQL DATATYPE to which the value must be converted ny the driver. Scale is used for java.sql.sqlTypes.DECIMAL and java.sql.sqlTypes.NUMERIC.

public void setCharacterStream(int parameterIndex, Reader rd, int length) throws SQLException
Sets the specified IN paramter to the Reader which has got length number of bytes. When very large UNICODE value is input to a LONGVARCHAR it is more practical to specify an Reader from which the data can be read. The driver does the necessary conversion from Unicode to database char format.

public void setRef(int i , Ref ref) throws SQLException
Use to set In parameter to reference of Structured data types.

public void setBlob(int i , Blob b) throws SQLException
Sets BLOB parameter.

public void setClob(int i , Clob c) throws SQLException
Sets CLOB parameter.

public void setArray(int i , Array a) throws SQLException
Sets ARRAYparameter.

public ResultSetMetaData getMetaData() throws SQLException
Get the number, types, and properties of a ResultSet's Column.


CallableStatement
A subclass of PreparedStatement.

This escape syntax for calling stored procedure has one form that includes a result parameter and one that does not. If used, the result parameter must be registered as an OUT parameter. The other parameters can be used for input, output or both. Parameters are referred to sequentially, by number. The first parameter is 1.

        {?= call <procedure-name>[<arg1>,<arg2>, ...]}
        {call <procedure-name>[<arg1>,<arg2>, ...]}
 

IN parameter values are set using the set methods inherited from PreparedStatement. The type of all OUT parameters must be registered prior to executing the stored procedure; their values are retrieved after execution via the get methods provided here.

Methods Specific to CallableStatement:

public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
Sets the data type of the out parameter. The data type determines the getXXX method to be used to retieve the out value after execution.
If the sqlType is specific to this particular database then java.sql.Types.OTHER should be used and getObject(int) method to retieve the value.

public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException
Same as above except that a scale can be provided when the SQL type is DECIMAL or NUMERIC.

public boolean wasNull() throws SQLException
Checks if the value returned by the last get method was SQL NULL.

public String getString(int paramIndex) throws SQLException
Get the value of a JDBC CHAR, VARCHAR or LONGVARCHAR.

public boolean getBoolean(int paramIndex) throws SQLException
Get the value of a JDBC BIT.

public boolean getByte(int paramIndex) throws SQLException
Get the value of a JDBC TINYBIT.

public boolean getShort(int paramIndex) throws SQLException
Get the value of a JDBC SMALLINT.

public boolean getInt(int paramIndex) throws SQLException
Get the value of a JDBC INTEGER.

public boolean getLong(int paramIndex) throws SQLException
Get the value of a JDBC BIGINT.

public boolean getFloat(int paramIndex) throws SQLException
Get the value of a JDBC FLOAT.

public boolean getDouble(int paramIndex) throws SQLException
Get the value of a JDBC DOUBLE.

public boolean getBigDecimal(int paramIndex) throws SQLException
Get the value of a JDBC NUMERIC.

public boolean getBytes(int paramIndex) throws SQLException
Get the value of a JDBC BINARY or VARBINARY.

public boolean getDate(int paramIndex) throws SQLException
Get the value of a JDBC DATE.

public boolean getTime(int paramIndex) throws SQLException
Get the value of a JDBC TIME.

public boolean getTimestamp(int paramIndex) throws SQLException
Get the value of a JDBC TIMESTAMP.

public boolean getObject(int paramIndex) throws SQLException
Get the value of a JDBC java.sql.Types.OTHER.

public boolean getRef(int paramIndex) throws SQLException
Get the value of a JDBC REF<Structured-type>.

public boolean getBlob(int paramIndex) throws SQLException
Get the value of a JDBC BLOB.

public boolean getClob(int paramIndex) throws SQLException
Get the value of a JDBC CLOB.

public boolean getArray(int paramIndex) throws SQLException
Get the value of a JDBC ARRAY.


ResultSet
Static final Int Fields:


Methods:

public boolean next() throws SQLException
Moves the cursor to the next row in the result set. A result set initially has the cursor pointing to the position before the first row and the next method need to be called before reading the first row from the ResultSet.

If an InputStream is opened for the current row, the call to next method closes it. The warning chain for the result set is cleared when the row is read.

The method returns true if the current row is valid and false otherwise.

public void close() throws SQLException
Releases the ResultSet object's database and JDBC resources immediately.
A resultSet object is automatically closed when the statement that created the resultSet is closed, re-executed, or is used to retieve the next reult from a sequence of multiple results. A resultSet is also automatically cloed when it is garbage collected.

public boolean wasNull()  throws SQLException
Returns true if the last getXXX() method returned a null value else false.

public String getString(int columnIndex)  throws SQLException
public String getString(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a Java String

public boolean getBoolean(int columnIndex)  throws SQLException
public boolean getBoolean(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a Java boolean

public boolean getByte(int columnIndex)  throws SQLException
public boolean getByte(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a Java byte.

public boolean getShort(int columnIndex)  throws SQLException
public boolean getShort(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a Java short.

public boolean getInt(int columnIndex)  throws SQLException
public boolean getInt(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a Java int.

public boolean getLong(int columnIndex)  throws SQLException
public boolean getLong(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a Java long.

public boolean getFloat(int columnIndex)  throws SQLException
public boolean getFloat(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a Java float.

public boolean getDouble(int columnIndex)  throws SQLException
public boolean getDouble(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a Java double.

public boolean getBytes(int columnIndex)  throws SQLException
public boolean getBytes(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a Java array of bytes.

public boolean getDate(int columnIndex)  throws SQLException
public boolean getDate(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a java.sql.Date.

public boolean getTime(int columnIndex)  throws SQLException
public boolean getTime(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a java.sql.Time.

public boolean getTimestamp(int columnIndex)  throws SQLException
public boolean getTimestamp(String columnName)  throws SQLException
Retrieve the value of the specified Column from the current row of the ResultSet as a java.sql.Timestamp.

public InputStream getAsciiStream(int columnIndex) throws SQLException
public InputStream getAsciiStream(String columnName) throws SQLException
Get the specified column as a stream of Ascii Characters. The Values can then be read in chunks from the stream. Suitable for reading very large LONGVARCHAR columns. JDBC driver will do the necessary conversion from Ascii to character format.

All data must be read from the stream before reading value of any other column. The next call to a get method will implicitly close the InputSteam. A stream may return 0 when the available methods is called even if there are 0 more more characters in the stream.

public InputStream getBinaryStream(int columnIndex) throws SQLException
public InputStream getBinaryStream(String columnName) throws SQLException
Similar to getAsciiStream method except that we have a binary stream if uninterpreted bytes rather than an Ascii stream. Used for large LONGVARBINARY values.

public  SQLWarning getWarnings()  throws SQLException
Get the first warning of the ResultSet. All other warnings are chained to the first warning. This are warning that a get method of the result set generated and for warnings generated statement methods will be chained on the statement object.

public void clearWarnings() throws SQLException
Clears all current warnings of the ResultSet object.

public String getCursorName() throws SQLException
Returns the name of the SQL cursor name used for this ResultSet. Please see the setCursorName method of Statement.

public ResultMetaData getMetaData() throws SQLException
Get the number, type and properties of the columns of the ResultSet.

public Object getObject(int columnIndex) throws SQLException
public Object getObject(String columnString) throws SQLException
The method reads the value of the specified column as a Java Object. The Java run time type of the Object is the default class corresponding to the SQL Column type, following the mapping of built-in type for JDBC spec.

The method can also be used to read SQL user-defined datatypes like structured type and distince types. In such a case it is same as calling getObject(int, getStatement().getConnection().getTypeMap()).

public int findColumn(String columnName) throws SQLException
Return the index number of the coumn. Index is 1-based.

public Reader getCharacterStream(int columnIndex) throws SQLException
public Reader getCharacterStream(String columnName) throws SQLException
Gets the value of a column in the current row as a java.io.Reader.

public getBigDecimal(int columnIndex) throws SQLException
public getBigDecimal(String columnName) throws SQLException
Get the value of the specified column as a java.math.BigDecimal.

public boolean isBeforeFirst() throws SQLException
Returns true if the cursor is before the first row of the resultset.

public boolean isAfterLast() throws SQLException
Returns true if the cursor is after the last row of the result set.

public boolean isFirst() throws SQLException
Returns true if the cursor is at the first row of the result set.

public boolean isLast() throws SQLException
Returns true if the cursor is at the last row of the resultSet.

public void beforeFirst() throws SQLException
Moves the cursor to the position before first row in the ResultSet.

public void afterLast() throws SQLException
Moves the cursor to the position after the last row of the ResultSet.

public boolean first() throws SQLException
Moves the cursor to the first row of the ResultSet. Returns true if the cursor is on a valid row else false.

public boolean last() throws SQLException
Moves the cursor to the last row of the ResultSet. Returns true if the cursor is on a valid row else false.

public int getRow() throws SQLException
Returns the number of the row where the cursor is presently positioned.

public void absolute(int posi) throws SQLException
Positions the cursor to the specified row. If a positive value is given for the row number then the cursor is positioned relative to the start of the result set. If a negative value is provided the cursor is positioned relative to the end of the result set.

absolute(1) is same as first() and absolute(-1) is same as last().
Trying to position the cursor beyond the first/last row results in positioning the cursor at the first/last row.

public booelan relative(int pos) throws SQLException
Positions the cursor relative to the current row position, either positive or negative.
Attemping to move beyond the first/last row results in positioning at the first and last row.  relative(0) puts to the same position.
relative(1) is different from next() as next could be called when the cursor might not actually be at a current row.
Returns true if the new position is a valid row.

public boolean previous(int pos) throws SQLException
Moves the cursor to the previous row in the result set.
relative(-1) and previous() are not same as it does not make sense to call relative() when there is no current position.

public void setFetchDirection(int direction) throws SQLException
Gives a hint to the driver as to in what direction the rows of the Resultset is to be fetched.

public int getFetchDirection() throws SQLException
Get the fetching direction of the result set.

public void setFetchSize(int size) throws SQLException
Sets the number of rows that is to be fetched from the database when more rows are needed from this result set.
The value must be between 0 and getMaxSize().

public int getFetchSize() throws SQLException
Gets the fecth size of this result set.

public int getType() throws SQLException
Get the type of this result set.

public int getConcurrency() throws SQLException
Get the concurrency mode of this result set.

public boolean rowUpdated() throws SQLException
Indicates whether the row has been updated or not. The value depends on whether or not the result set allows updates.

public boolean rowInserted() throws SQLException
Indicates whether the row has been inserted or not. The value depends on whether or not the result set allows insertion.

public boolean rowDeleted() throws SQLException
Indicates whether the row has been deleted or not. The value depends on whether or not the result set allows deletion.

public void updateNull(int  columnIndex) throws SQLException
public void updateNull(String columnName) throws SQLException
Update a nullable column to a null value. Used to update a column in the current row or in insertRow.

public void updateBoolean(int  columnIndex, boolean x) throws SQLException
public void updateBoolean(String columnName, boolean x) throws SQLException
Update a column with a boolean value. Used to update a column in the current row or in insertRow.

public void updateByte(int  columnIndex, byte x) throws SQLException
public void updateByte(String columnName, byte x) throws SQLException
Update a column with a byte value. Used to update a column in the current row or in insertRow.

public void updateShort(int  columnIndex, short x) throws SQLException
public void updateShort(String columnName, short x) throws SQLException
Update a column with a short value. Used to update a column in the current row or in insertRow.

public void updateInt(int  columnIndex, int x) throws SQLException
public void updateInt(String columnName, int x) throws SQLException
Update a column with a int value. Used to update a column in the current row or in insertRow.

public void updateLong(int  columnIndex, long x) throws SQLException
public void updateLong(String columnName, long x) throws SQLException
Update a column with a long value. Used to update a column in the current row or in insertRow.

public void updateFloat(int  columnIndex, float x) throws SQLException
public void updateFloat(String columnName, float x) throws SQLException
Update a column with a float value. Used to update a column in the current row or in insertRow.

public void updateDouble(int  columnIndex, double x) throws SQLException
public void updateDouble(String columnName, double x) throws SQLException
Update a column with a double value. Used to update a column in the current row or in insertRow.

public void updateBigDecimal(int  columnIndex, BigDecimal x) throws SQLException
public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException
Update a column with a BigDecimal value. Used to update a column in the current row or in insertRow.

public void updateString(int  columnIndex, String x) throws SQLException
public void updateString(String columnName, String x) throws SQLException
Update a column with a String value. Used to update a column in the current row or in insertRow.

public void updateBytes(int  columnIndex, byte[] x) throws SQLException
public void updateBytesString columnName, byte[] x) throws SQLException
Update a column with a byte array. Used to update a column in the current row or in insertRow.

public void updateDate(int  columnIndex, Date x) throws SQLException
public void updateDate(String columnName, Date x) throws SQLException
Update a column with a Date value. Used to update a column in the current row or in insertRow.

public void updateTime(int  columnIndex, Time x) throws SQLException
public void updateTime(String columnName, Time x) throws SQLException
Update a column with a Time value. Used to update a column in the current row or in insertRow.

public void updateTimestamp(int  columnIndex, Timestamp x) throws SQLException
public void updateTimestamp(String columnName, Timestamp x) throws SQLException
Update a column with a Timestamp value. Used to update a column in the current row or in insertRow.

public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException
public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException
Updates a colun with an Ascii InputStream that has length number of Ascii characters. Used to update a column in the current row or in insertRow.

public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException
public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException
Updates a colun with a Binary InputStream that has length number of bytes.Used to update a column in the current row or in insertRow.

public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException
public void updateCharacterStream(String columnName, Reader x, int length) throws SQLException
Updates a colun with a Reader that has length number of unicode characters. Used to update a column in the current row or in insertRow.

public void updateObject(int columnIndex, Object x) throws SQLException
public void updateObject(int columnIndex, Object x, int scale) throws SQLException
public void updateObject(String columnName, Object x) throws SQLException
public void updateObject(String columnName, Object x, int scale) throws SQLException
Sets value of a column to an object. For DECIMAL and NUMERIC values scale is used.

public void insertRow() throws SQLException
Insert the row in the InsertRow into the database and the resultSet.

public void updateRow() throws SQLException
Update the row on the database and the result set also. Cannot be called when the cursor is at InsertRow.

public void deleteRow() throws SQLException
Delete the row from the result set and thedatabase. Cannot call when the cursor is at InsertRow.

public void refreshRow() throws SQLException
Used to refresh the resultSet with the latest rows from the database.

public void cancelRowUpdates() throws SQLException
Cancel all updates to a row.

public void moveToInsertRow() throws SQLException
Moves the cursor to the insert row. The insert row is a buffer area where a a new row can be constructed using the updateXXX methods.

public void moveToCurrentRow() throws SQLException
Moves the cursor back to the row where it was before calling moveToInsertRow.
It has no effect it the cursor is not currently at the insert row.

public Statement getStatement() throws SQLException
Returns the Statement object that generated this result set.

public Object getObject(int i, Map map) throws SQLException
public Object getObject(String columnName, Map map) throws SQLException
Returns the value of the column as a java object using the mapping specified.

public Ref getRef(int i) throws SQLException
public Ref getRef(String columnName) throws SQLException
Get a ref(<structured-type>) column value from the current row.

public Blob getBlob(int i) throws SQLException
public Blob getBlob(String columnName) throws SQLException
Get a Blob column value from the current row.

public Clob getClob(int i) throws SQLException
public Clob getClob(String columnName) throws SQLException
Get a Clob column value from the current row.

public Array getArray(int i) throws SQLException
public Array getArray(String columnName) throws SQLException
Get a Array column value from the current row.


ResultSetMetaData:
Used to represent the type, and properties of columns of a result set.

Static final int fields:

columnNoNulls: The column cannot have null values
columnNullable: The column can have null values
columnNullableUnknown: The nullability of a column is unknown

Methods:

public String getCatalogName(int column) throws SQLException
Get the name of the column's tables's catalog name

public String getSchemaName(int column) throws SQLException
Get the column's table's Schema name

public String getColumnName(int column) throws SQLException
Get the name of the column

public String getTableName(int column) throws SQLException
Get the column's table name

public int getColumnCount() throws SQLException
Get the number of columns in the  result set.

public boolean isDefinitelyWritable(int column) throws SQLException
Determine whether a write on the column will definitely succeed.

public boolean isReadOnly(int column) throws SQLException
Determine whether the column is not writable

public boolean isSearchable(int column) throws SQLException
Determine if the column can be a part of the WHERE clause

public boolean isSigned(int column) throws SQLException
Determine if the column represents signed numbers

public boolean isWritable(int column) throws SQLException
Determine whether a write can be done on the column

public boolean isNullable(int column) throws SQLException
Determine the nullability of a column

public int getColumnDisplaySize(int column) throws SQLException
Determine the column's normal max width in chars

public String getColumnLabel(int column) throws SQLException
Get the suggested colum title to be used in printouts and reports

public int getColumnType(int column) throws SQLException
Get the column's SQL type

public String getColumnTypeName(int column) throws SQLException
Get the column's database specific type-name

public String getColumnClassName(int column) throws SQLException
Get the fully qualified Java class name whose instances are generated when the ResultSet.getObject() method is used on this column.

public int getPrecision(int column) throws SQLException
Get the nummer of decimal digits

public int getScale(int column) throws SQLException
Get the number of digits to the right of the decimal point

public boolean isAutoIncrement(int column) throws SQLException
Returns true of the column is of type auto increment and hence read only.

public boolean isCaseSensitive(int column) throws SQLException
Determines if the case of the column values matters.

public boolean isCurrency(int column) throws SQLException
Determine if the column represents a cash value.


Array:
Methods:

public Object getArray() throws SQLException
public Object getArray(long index, int count) throws SQLException
public Object getArray(long index, int count, Map map) throws SQLException
public Object getArray(Map map) throws SQLException

The method to get the SQL Array this Array reference points to and convert into a java Object, which can be used as a normal Java array. The index and count arguments are meant to slice the elements of the Array. The elements of the array will be converted by the driver based on the map, if custom mapping has been done.

public int getBaseType() throws SQLException
Get the base type of the elements represented by this Array.

public String getBaseTypeName() throws SQLException
Get the name of the Base type of the Array.

public ResultSet getResultSet() throws SQLException
public ResultSet getResultSet(long index, int count) throws SQLException
public ResultSet getResultSet(long index, int count, Map map) throws SQLException
public ResultSet getResultSet(Map map) throws SQLException

Returns the elements of the Array as a result set.


Blob:
A Blob instance is valid for the duration of the transaction in which it is created.

Methods:

public InputStream getBinaryStream() throws SQLException
Get the BLOB object this Blob represents as a Stream.

public byte[] getBytes(long index, int count) throws SQLException
Get a slice of the BLOB as an array of bytes.

public long length() throws SQLException
Get the number of bytes in the BLOB value this Blob instance represent.

public long position(Blob pattern, long start) throws SQLException
public long position(byte[] pattern, long start) throws SQLException
Get the byte position in the BLOB that this Blob instance represents, where the pattern begins.
 

Clob
A Clob instance is valid for duration of the transaction in which it was created.

Methods:

public InputStream getAsciiStream() throws SQLException
Get the CLOB value designated by the Clob instance as an AsciiStream

public Reader getCharacterStream() throws SQLException
Get the CLOB value designated by the Clob instance as a Reader.

public String getSubString(long index, int length) throws SQLException
Returns a copy of the Specified substring of the CLOB Object this Clob instance points to.

public long length() throws SQLException
Returns the number of characters in the CLOB object this Clob points to.

public long position(Clob pattern, long start) throws SQLException
public long position(byte[] pattern, long start) throws SQLException
Determine the character position at which the specified substring pattern appears in the CLOB.


Ref:
A reference to an SQL structured type value in the database.

Method:

public String getBaseTypeName() throws SQLException
Get the fully-qualified SQL structured type name of the referenced item.