background image
<< java.sql.PreparedStatement interface | ResultSets and streaming columns >>

java.sql.ResultSet interface

<< java.sql.PreparedStatement interface | ResultSets and streaming columns >>
Derby Reference Manual
314
Column
Data Type
Corresponding
Java Type
AsciiStream CharacterStreamBinaryStream
BINARY
None
Yes
Yes
Yes
BLOB
java.sql.Blob
Yes
Yes
Yes
VARBINARY
None
Yes
Yes
Yes
LONGVARBINARY None
Yes
Yes
Preferred
Note: Streams cannot be stored in columns of the other built-in data types or columns of
user-defined data types.
Example
The following code fragment shows how a user can store a streamed, ASCII-encoded
java.io.File in a LONG VARCHAR column:
Statement s = conn.createStatement();
s.executeUpdate("CREATE TABLE atable (a INT, b LONG VARCHAR)");
conn.commit();
java.io.File file = new java.io.File("derby.txt");
int fileLength = (int) file.length();
// create an input stream
java.io.InputStream fin = new java.io.FileInputStream(file);
PreparedStatement ps = conn.prepareStatement(
"INSERT INTO atable VALUES (?, ?)");
ps.setInt(1, 1);
// set the value of the input parameter to the input stream
ps.setAsciiStream(2, fin, fileLength);
ps.execute();
conn.commit();
java.sql.ResultSet interface
A positioned update or delete issued against a cursor being accessed through a
ResultSet object modifies or deletes the current row of the ResultSet object.
Some intermediate protocols might pre-fetch rows. This causes positioned updates and
deletes to operate against the row the underlying cursor is on, and not the current row of
the ResultSet.
JDBC does not define the sort of rounding to use for ResultSet.getBigDecimal. Derby
uses java.math.BigDecimal.ROUND_HALF_DOWN.
The following table describes features of ResultSet methods that are specific to Derby.
Table 124.
Implementation notes on ResultSet methods
Returns
Signature
Implementation Notes
void
deleteRow()
After the row is deleted, the ResultSet
object will be positioned before the next
row. Before issuing any methods other than
close on the ResultSet object, the program
will need to reposition the ResultSet object.
int
getConcurrency()
If the Statement object has
CONCUR_READ_ONLY concurrency,
then this method will return