BaseRowSet (Java SE 15 & JDK 15) (original) (raw)
All Implemented Interfaces:
[Serializable](../../../../java.base/java/io/Serializable.html "interface in java.io")
, [Cloneable](../../../../java.base/java/lang/Cloneable.html "interface in java.lang")
public abstract class BaseRowSet extends Object implements Serializable, Cloneable
An abstract class providing a RowSet
object with its basic functionality. The basic functions include having properties and sending event notifications, which all JavaBeans components must implement.
1.0 Overview
The BaseRowSet
class provides the core functionality for all RowSet
implementations, and all standard implementations may use this class in combination with one or more RowSet
interfaces in order to provide a standard vendor-specific implementation. To clarify, all implementations must implement at least one of the RowSet
interfaces (JdbcRowSet
,CachedRowSet
, JoinRowSet
, FilteredRowSet
, or WebRowSet
). This means that any implementation that extends the BaseRowSet
class must also implement one of the RowSet
interfaces.
The BaseRowSet
class provides the following:
- Properties
- Fields for storing current properties
- Methods for getting and setting properties
- Event notification
- A complete set of setter methods for setting the parameters in a
RowSet
object's command - Streams
- Fields for storing stream instances
- Constants for indicating the type of a stream
2.0 Setting Properties
All rowsets maintain a set of properties, which will usually be set using a tool. The number and kinds of properties a rowset has will vary, depending on what the RowSet
implementation does and how it gets its data. For example, rowsets that get their data from a ResultSet
object need to set the properties that are required for making a database connection. If a RowSet
object uses the DriverManager
facility to make a connection, it needs to set a property for the JDBC URL that identifies the appropriate driver, and it needs to set the properties that give the user name and password. If, on the other hand, the rowset uses a DataSource
object to make the connection, which is the preferred method, it does not need to set the property for the JDBC URL. Instead, it needs to set the property for the logical name of the data source along with the properties for the user name and password.
NOTE: In order to use a DataSource
object for making a connection, the DataSource
object must have been registered with a naming service that uses the Java Naming and Directory Interface (JNDI) API. This registration is usually done by a person acting in the capacity of a system administrator.
3.0 Setting the Command and Its Parameters
When a rowset gets its data from a relational database, it executes a command (a query) that produces a ResultSet
object. This query is the command that is set for the RowSet
object's command property. The rowset populates itself with data by reading the data from the ResultSet
object into itself. If the query contains placeholders for values to be set, the BaseRowSet
setter methods are used to set these values. All setter methods allow these values to be set to null
if required.
The following code fragment illustrates how theCachedRowSet
object crs
might have its command property set. Note that if a tool is used to set properties, this is the code that the tool would use.
crs.setCommand("SELECT FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMERS" +
"WHERE CREDIT_LIMIT > ? AND REGION = ?");
In this example, the values for CREDIT_LIMIT
andREGION
are placeholder parameters, which are indicated with a question mark (?). The first question mark is placeholder parameter number1
, the second question mark is placeholder parameter number2
, and so on. Any placeholder parameters must be set with values before the query can be executed. To set these placeholder parameters, the BaseRowSet
class provides a set of setter methods, similar to those provided by the PreparedStatement
interface, for setting values of each data type. A RowSet
object stores the parameter values internally, and its execute
method uses them internally to set values for the placeholder parameters before it sends the command to the DBMS to be executed.
The following code fragment demonstrates setting the two parameters in the query from the previous example.
crs.setInt(1, 5000);
crs.setString(2, "West");
If the execute
method is called at this point, the query sent to the DBMS will be:
"SELECT FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMERS" +
"WHERE CREDIT_LIMIT > 5000 AND REGION = 'West'"
NOTE: Setting Array
, Clob
, Blob
andRef
objects as a command parameter, stores these values asSerialArray
, SerialClob
, SerialBlob
and SerialRef
objects respectively.
4.0 Handling of Parameters Behind the Scenes
NOTE: The BaseRowSet
class provides two kinds of setter methods, those that set properties and those that set placeholder parameters. The setter methods discussed in this section are those that set placeholder parameters.
The placeholder parameters set with the BaseRowSet
setter methods are stored as objects in an internal Hashtable
object. Primitives are stored as their Object
type. For example, byte
is stored as Byte
object, and int
is stored as an Integer
object. When the method execute
is called, the values in theHashtable
object are substituted for the appropriate placeholder parameters in the command.
A call to the method getParams
returns the values stored in theHashtable
object as an array of Object
instances. An element in this array may be a simple Object
instance or an array (which is a type of Object
). The particular setter method used determines whether an element in this array is an Object
or an array.
The majority of methods for setting placeholder parameters take two parameters, with the first parameter indicating which placeholder parameter is to be set, and the second parameter giving the value to be set. Methods such as setInt
,setString
, setBoolean
, and setLong
fall into this category. After these methods have been called, a call to the methodgetParams
will return an array with the values that have been set. Each element in the array is an Object
instance representing the values that have been set. The order of these values in the array is determined by theint
(the first parameter) passed to the setter method. The values in the array are the values (the second parameter) passed to the setter method. In other words, the first element in the array is the value to be set for the first placeholder parameter in the RowSet
object's command. The second element is the value to be set for the second placeholder parameter, and so on.
Several setter methods send the driver and DBMS information beyond the value to be set. When the method getParams
is called after one of these setter methods has been used, the elements in the array will themselves be arrays to accommodate the additional information. In this category, the method setNull
is a special case because one version takes only two parameters (setNull(int parameterIndex, int SqlType)
). Nevertheless, it requires an array to contain the information that will be passed to the driver and DBMS. The first element in this array is the value to be set, which is null
, and the second element is the int
supplied for sqlType, which indicates the type of SQL value that is being set to null
. This information is needed by some DBMSs and is therefore required in order to ensure that applications are portable. The other version is intended to be used when the value to be set to null
is a user-defined type. It takes three parameters (setNull(int parameterIndex, int sqlType, String typeName)
) and also requires an array to contain the information to be passed to the driver and DBMS. The first two elements in this array are the same as for the first version ofsetNull
. The third element, typeName, gives the SQL name of the user-defined type. As is true with the other setter methods, the number of the placeholder parameter to be set is indicated by an element's position in the array returned by getParams
. So, for example, if the parameter supplied to setNull
is 2
, the second element in the array returned by getParams
will be an array of two or three elements.
Some methods, such as setObject
and setDate
have versions that take more than two parameters, with the extra parameters giving information to the driver or the DBMS. For example, the methods setDate
,setTime
, and setTimestamp
can take a Calendar
object as their third parameter. If the DBMS does not store time zone information, the driver uses the Calendar
object to construct the Date
,Time
, or Timestamp
object being set. As is true with other methods that provide additional information, the element in the array returned by getParams
is an array instead of a simple Object
instance.
The methods setAsciiStream
, setBinaryStream
,setCharacterStream
, and setUnicodeStream
(which is deprecated, so applications should use getCharacterStream
instead) take three parameters, so for them, the element in the array returned bygetParams
is also an array. What is different about these setter methods is that in addition to the information provided by parameters, the array contains one of the BaseRowSet
constants indicating the type of stream being set.
NOTE: The method getParams
is called internally byRowSet
implementations extending this class; it is not normally called by an application programmer directly.
5.0 Event Notification
The BaseRowSet
class provides the event notification mechanism for rowsets. It contains the fieldlisteners
, methods for adding and removing listeners, and methods for notifying listeners of changes.
A listener is an object that has implemented the RowSetListener
interface. If it has been added to a RowSet
object's list of listeners, it will be notified when an event occurs on that RowSet
object. Each listener's implementation of the RowSetListener
methods defines what that object will do when it is notified that an event has occurred.
There are three possible events for a RowSet
object:
- the cursor moves
- an individual row is changed (updated, deleted, or inserted)
- the contents of the entire
RowSet
object are changed
The BaseRowSet
method used for the notification indicates the type of event that has occurred. For example, the methodnotifyRowChanged
indicates that a row has been updated, deleted, or inserted. Each of the notification methods creates aRowSetEvent
object, which is supplied to the listener in order to identify the RowSet
object on which the event occurred. What the listener does with this information, which may be nothing, depends on how it was implemented.
6.0 Default Behavior
A default BaseRowSet
object is initialized with many starting values. The following is true of a default RowSet
instance that extends the BaseRowSet
class:
- Has a scrollable cursor and does not show changes made by others.
- Is updatable.
- Does not show rows that have been deleted.
- Has no time limit for how long a driver may take to execute the
RowSet
object's command. - Has no limit for the number of rows it may contain.
- Has no limit for the number of bytes a column may contain. NOTE: This limit applies only to columns that hold values of the following types:
BINARY
,VARBINARY
,LONGVARBINARY
,CHAR
,VARCHAR
, andLONGVARCHAR
. - Will not see uncommitted data (make "dirty" reads).
- Has escape processing turned on.
- Has its connection's type map set to
null
. - Has an empty
Vector
object for storing the values set for the placeholder parameters in theRowSet
object's command.
If other values are desired, an application must set the property values explicitly. For example, the following line of code sets the maximum number of rows for the CachedRowSet
object crs to 500.
crs.setMaxRows(500);
Methods implemented in extensions of this BaseRowSet
class must throw anSQLException
object for any violation of the defined assertions. Also, if the extending class overrides and reimplements any BaseRowSet
method and encounters connectivity or underlying data source issues, that method may in addition throw anSQLException
object for that reason.
Since:
1.5
See Also:
Field Summary
Fields
Modifier and Type | Field | Description |
---|---|---|
static int | ASCII_STREAM_PARAM | A constant indicating to a RowSetReaderImpl object that a given parameter is an ASCII stream. |
protected InputStream | asciiStream | The InputStream object that will be returned by the method getAsciiStream, which is specified in the ResultSet interface. |
static int | BINARY_STREAM_PARAM | A constant indicating to a RowSetReaderImpl object that a given parameter is a binary stream. |
protected InputStream | binaryStream | The InputStream object that will be returned by the method getBinaryStream, which is specified in the ResultSet interface. |
protected Reader | charStream | The Reader object that will be returned by the method getCharacterStream, which is specified in the ResultSet interface. |
static int | UNICODE_STREAM_PARAM | A constant indicating to a RowSetReaderImpl object that a given parameter is a Unicode stream. |
protected InputStream | unicodeStream | The InputStream object that will be returned by the method getUnicodeStream, which is specified in the ResultSet interface. |
Constructor Summary
Constructors
Constructor | Description |
---|---|
BaseRowSet() | Constructs a new BaseRowSet object initialized with a default Vector object for its listeners field. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
void | addRowSetListener(RowSetListener listener) | The listener will be notified whenever an event occurs on this RowSet object. |
void | clearParameters() | Clears all of the current parameter values in this RowSet object's internal representation of the parameters to be set in this RowSet object's command when it is executed. |
String | getCommand() | Retrieves the SQL query that is the command for thisRowSet object. |
int | getConcurrency() | Returns the concurrency for this RowSet object. |
String | getDataSourceName() | Returns the logical name that when supplied to a naming service that uses the Java Naming and Directory Interface (JNDI) API, will retrieve a javax.sql.DataSource object. |
boolean | getEscapeProcessing() | Ascertains whether escape processing is enabled for thisRowSet object. |
int | getFetchDirection() | Retrieves this RowSet object's current setting for the fetch direction. |
int | getFetchSize() | Returns the fetch size for this RowSet object. |
int | getMaxFieldSize() | Retrieves the maximum number of bytes that can be used for a column value in this RowSet object. |
int | getMaxRows() | Retrieves the maximum number of rows that this RowSet object may contain. |
Object[] | getParams() | Retrieves an array containing the parameter values (both Objects and primitives) that have been set for thisRowSet object's command and throws an SQLException object if all parameters have not been set. |
String | getPassword() | Returns the password used to create a database connection for thisRowSet object. |
int | getQueryTimeout() | Retrieves the maximum number of seconds the driver will wait for a query to execute. |
boolean | getShowDeleted() | Retrieves a boolean indicating whether rows marked for deletion appear in the set of current rows. |
int | getTransactionIsolation() | Returns the transaction isolation property for thisRowSet object's connection. |
int | getType() | Returns the type of this RowSet object. |
Map<String,Class<?>> | getTypeMap() | Retrieves the type map associated with the Connection object for this RowSet object. |
String | getUrl() | Retrieves the JDBC URL that this RowSet object'sjavax.sql.Reader object uses to make a connection with a relational database using a JDBC technology-enabled driver. |
String | getUsername() | Returns the user name used to create a database connection. |
protected void | initParams() | Performs the necessary internal configurations and initializations to allow any JDBC RowSet implementation to start using the standard facilities provided by a BaseRowSet instance. |
boolean | isReadOnly() | Returns a boolean indicating whether thisRowSet object is read-only. |
protected void | notifyCursorMoved() | Notifies all of the listeners registered with thisRowSet object that its cursor has moved. |
protected void | notifyRowChanged() | Notifies all of the listeners registered with this RowSet object that one of its rows has changed. |
protected void | notifyRowSetChanged() | Notifies all of the listeners registered with this RowSet object that its entire contents have changed. |
void | removeRowSetListener(RowSetListener listener) | Removes the designated object from this RowSet object's list of listeners. |
void | setArray(int parameterIndex,Array array) | Sets the designated parameter to an Array object in the Java programming language. |
void | setAsciiStream(int parameterIndex,InputStream x) | Sets the designated parameter in this RowSet object's command to the given input stream. |
void | setAsciiStream(int parameterIndex,InputStream x, int length) | Sets the designated parameter to the givenjava.io.InputStream object, which will have the specified number of bytes. |
void | setAsciiStream(String parameterName,InputStream x) | Sets the designated parameter to the given input stream. |
void | setAsciiStream(String parameterName,InputStream x, int length) | Sets the designated parameter to the given input stream, which will have the specified number of bytes. |
void | setBigDecimal(int parameterIndex,BigDecimal x) | Sets the designated parameter to the givenjava.lang.BigDecimal value. |
void | setBigDecimal(String parameterName,BigDecimal x) | Sets the designated parameter to the givenjava.math.BigDecimal value. |
void | setBinaryStream(int parameterIndex,InputStream x) | Sets the designated parameter in this RowSet object's command to the given input stream. |
void | setBinaryStream(int parameterIndex,InputStream x, int length) | Sets the designated parameter to the given java.io.InputStream object, which will have the specified number of bytes. |
void | setBinaryStream(String parameterName,InputStream x) | Sets the designated parameter to the given input stream. |
void | setBinaryStream(String parameterName,InputStream x, int length) | Sets the designated parameter to the given input stream, which will have the specified number of bytes. |
void | setBlob(int parameterIndex,InputStream inputStream) | Sets the designated parameter to a InputStream object. |
void | setBlob(int parameterIndex,InputStream inputStream, long length) | Sets the designated parameter to a InputStream object. |
void | setBlob(int parameterIndex,Blob x) | Sets the designated parameter to the given Blob object in the Java programming language. |
void | setBlob(String parameterName,InputStream inputStream) | Sets the designated parameter to a InputStream object. |
void | setBlob(String parameterName,InputStream inputStream, long length) | Sets the designated parameter to a InputStream object. |
void | setBlob(String parameterName,Blob x) | Sets the designated parameter to the given java.sql.Blob object. |
void | setBoolean(int parameterIndex, boolean x) | Sets the designated parameter to the given boolean in the Java programming language. |
void | setBoolean(String parameterName, boolean x) | Sets the designated parameter to the given Java boolean value. |
void | setByte(int parameterIndex, byte x) | Sets the designated parameter to the given byte in the Java programming language. |
void | setByte(String parameterName, byte x) | Sets the designated parameter to the given Java byte value. |
void | setBytes(int parameterIndex, byte[] x) | Sets the designated parameter to the given array of bytes. |
void | setBytes(String parameterName, byte[] x) | Sets the designated parameter to the given Java array of bytes. |
void | setCharacterStream(int parameterIndex,Reader reader) | Sets the designated parameter in this RowSet object's command to the given Reader object. |
void | setCharacterStream(int parameterIndex,Reader reader, int length) | Sets the designated parameter to the given java.io.Reader object, which will have the specified number of characters. |
void | setCharacterStream(String parameterName,Reader reader) | Sets the designated parameter to the given Reader object. |
void | setCharacterStream(String parameterName,Reader reader, int length) | Sets the designated parameter to the given Reader object, which is the given number of characters long. |
void | setClob(int parameterIndex,Reader reader) | Sets the designated parameter to a Reader object. |
void | setClob(int parameterIndex,Reader reader, long length) | Sets the designated parameter to a Reader object. |
void | setClob(int parameterIndex,Clob x) | Sets the designated parameter to the given Clob object in the Java programming language. |
void | setClob(String parameterName,Reader reader) | Sets the designated parameter to a Reader object. |
void | setClob(String parameterName,Reader reader, long length) | Sets the designated parameter to a Reader object. |
void | setClob(String parameterName,Clob x) | Sets the designated parameter to the given java.sql.Clob object. |
void | setCommand(String cmd) | Sets this RowSet object's command property to the given String object and clears the parameters, if any, that were set for the previous command. |
void | setConcurrency(int concurrency) | Sets the concurrency for this RowSet object to the specified concurrency. |
void | setDataSourceName(String name) | Sets the DataSource name property for this RowSet object to the given logical name and sets this RowSet object's Url property to null. |
void | setDate(int parameterIndex,Date x) | Sets the designated parameter to the given java.sql.Date value. |
void | setDate(int parameterIndex,Date x,Calendar cal) | Sets the designated parameter to the given java.sql.Date object. |
void | setDate(String parameterName,Date x) | Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application. |
void | setDate(String parameterName,Date x,Calendar cal) | Sets the designated parameter to the given java.sql.Date value, using the given Calendar object. |
void | setDouble(int parameterIndex, double x) | Sets the designated parameter to the given double in the Java programming language. |
void | setDouble(String parameterName, double x) | Sets the designated parameter to the given Java double value. |
void | setEscapeProcessing(boolean enable) | Sets to the given boolean whether or not the driver will scan for escape syntax and do escape substitution before sending SQL statements to the database. |
void | setFetchDirection(int direction) | Gives the driver a performance hint as to the direction in which the rows in this RowSet object will be processed. |
void | setFetchSize(int rows) | Sets the fetch size for this RowSet object to the given number of rows. |
void | setFloat(int parameterIndex, float x) | Sets the designated parameter to the given float in the Java programming language. |
void | setFloat(String parameterName, float x) | Sets the designated parameter to the given Java float value. |
void | setInt(int parameterIndex, int x) | Sets the designated parameter to an int in the Java programming language. |
void | setInt(String parameterName, int x) | Sets the designated parameter to the given Java int value. |
void | setLong(int parameterIndex, long x) | Sets the designated parameter to the given long in the Java programming language. |
void | setLong(String parameterName, long x) | Sets the designated parameter to the given Java long value. |
void | setMaxFieldSize(int max) | Sets the maximum number of bytes that can be used for a column value in this RowSet object to the given number. |
void | setMaxRows(int max) | Sets the maximum number of rows that this RowSet object may contain to the given number. |
void | setNCharacterStream(int parameterIndex,Reader value) | Sets the designated parameter in this RowSet object's command to a Reader object. |
void | setNCharacterStream(int parameterIndex,Reader value, long length) | Sets the designated parameter to a Reader object. |
void | setNCharacterStream(String parameterName,Reader value) | Sets the designated parameter to a Reader object. |
void | setNCharacterStream(String parameterName,Reader value, long length) | Sets the designated parameter to a Reader object. |
void | setNClob(int parameterIndex,Reader reader) | Sets the designated parameter to a Reader object. |
void | setNClob(int parameterIndex,Reader reader, long length) | Sets the designated parameter to a Reader object. |
void | setNClob(int parameterIndex,NClob value) | Sets the designated parameter to a java.sql.NClob object. |
void | setNClob(String parameterName,Reader reader) | Sets the designated parameter to a Reader object. |
void | setNClob(String parameterName,Reader reader, long length) | Sets the designated parameter to a Reader object. |
void | setNClob(String parameterName,NClob value) | Sets the designated parameter to a java.sql.NClob object. |
void | setNString(int parameterIndex,String value) | Sets the designated parameter to the given String object. |
void | setNString(String parameterName,String value) | Sets the designated parameter to the given String object. |
void | setNull(int parameterIndex, int sqlType) | Sets the designated parameter to SQL NULL. |
void | setNull(int parameterIndex, int sqlType,String typeName) | Sets the designated parameter to SQL NULL. |
void | setNull(String parameterName, int sqlType) | Sets the designated parameter to SQL NULL. |
void | setNull(String parameterName, int sqlType,String typeName) | Sets the designated parameter to SQL NULL. |
void | setObject(int parameterIndex,Object x) | Sets the designated parameter to an Object in the Java programming language. |
void | setObject(int parameterIndex,Object x, int targetSqlType) | Sets the value of the designated parameter with the givenObject value. |
void | setObject(int parameterIndex,Object x, int targetSqlType, int scale) | Sets the designated parameter to an Object in the Java programming language. |
void | setObject(String parameterName,Object x) | Sets the value of the designated parameter with the given object. |
void | setObject(String parameterName,Object x, int targetSqlType) | Sets the value of the designated parameter with the given object. |
void | setObject(String parameterName,Object x, int targetSqlType, int scale) | Sets the value of the designated parameter with the given object. |
void | setPassword(String pass) | Sets the password used to create a database connection for thisRowSet object to the given String object. |
void | setQueryTimeout(int seconds) | Sets to the given number the maximum number of seconds the driver will wait for a query to execute. |
void | setReadOnly(boolean value) | Sets this RowSet object's readOnly property to the given boolean. |
void | setRef(int parameterIndex,Ref ref) | Sets the designated parameter to the given Ref object in the Java programming language. |
void | setRowId(int parameterIndex,RowId x) | Sets the designated parameter to the given java.sql.RowId object. |
void | setRowId(String parameterName,RowId x) | Sets the designated parameter to the given java.sql.RowId object. |
void | setShort(int parameterIndex, short x) | Sets the designated parameter to the given short in the Java programming language. |
void | setShort(String parameterName, short x) | Sets the designated parameter to the given Java short value. |
void | setShowDeleted(boolean value) | Sets the property showDeleted to the givenboolean value, which determines whether rows marked for deletion appear in the set of current rows. |
void | setSQLXML(int parameterIndex,SQLXML xmlObject) | Sets the designated parameter to the given java.sql.SQLXML object. |
void | setSQLXML(String parameterName,SQLXML xmlObject) | Sets the designated parameter to the given java.sql.SQLXML object. |
void | setString(int parameterIndex,String x) | Sets the designated parameter to the given String value. |
void | setString(String parameterName,String x) | Sets the designated parameter to the given Java String value. |
void | setTime(int parameterIndex,Time x) | Sets the designated parameter to the given java.sql.Time value. |
void | setTime(int parameterIndex,Time x,Calendar cal) | Sets the designated parameter to the given java.sql.Time object. |
void | setTime(String parameterName,Time x) | Sets the designated parameter to the given java.sql.Time value. |
void | setTime(String parameterName,Time x,Calendar cal) | Sets the designated parameter to the given java.sql.Time value, using the given Calendar object. |
void | setTimestamp(int parameterIndex,Timestamp x) | Sets the designated parameter to the givenjava.sql.Timestamp value. |
void | setTimestamp(int parameterIndex,Timestamp x,Calendar cal) | Sets the designated parameter to the givenjava.sql.Timestamp object. |
void | setTimestamp(String parameterName,Timestamp x) | Sets the designated parameter to the given java.sql.Timestamp value. |
void | setTimestamp(String parameterName,Timestamp x,Calendar cal) | Sets the designated parameter to the given java.sql.Timestamp value, using the given Calendar object. |
void | setTransactionIsolation(int level) | Sets the transaction isolation property for this JDBC RowSet object to the given constant. |
void | setType(int type) | Sets the type for this RowSet object to the specified type. |
void | setTypeMap(Map<String,Class<?>> map) | Installs the given java.util.Map object as the type map associated with the Connection object for thisRowSet object. |
void | setUnicodeStream(int parameterIndex,InputStream x, int length) | Deprecated. |
void | setUrl(String url) | Sets the Url property for this RowSet object to the given String object and sets the dataSource name property to null. |
void | setURL(int parameterIndex,URL x) | Sets the designated parameter to the given java.net.URL value. |
void | setUsername(String name) | Sets the username property for this RowSet object to the given user name. |
Methods declared in class java.lang.Object
[clone](../../../../java.base/java/lang/Object.html#clone%28%29), [equals](../../../../java.base/java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../../../java.base/java/lang/Object.html#finalize%28%29), [getClass](../../../../java.base/java/lang/Object.html#getClass%28%29), [hashCode](../../../../java.base/java/lang/Object.html#hashCode%28%29), [notify](../../../../java.base/java/lang/Object.html#notify%28%29), [notifyAll](../../../../java.base/java/lang/Object.html#notifyAll%28%29), [toString](../../../../java.base/java/lang/Object.html#toString%28%29), [wait](../../../../java.base/java/lang/Object.html#wait%28%29), [wait](../../../../java.base/java/lang/Object.html#wait%28long%29), [wait](../../../../java.base/java/lang/Object.html#wait%28long,int%29)
Field Details
UNICODE_STREAM_PARAM
public static final int UNICODE_STREAM_PARAM
A constant indicating to aRowSetReaderImpl
object that a given parameter is a Unicode stream. ThisRowSetReaderImpl
object is provided as an extension of theSyncProvider
abstract class defined in theSyncFactory
static factory SPI mechanism.
See Also:
Constant Field ValuesBINARY_STREAM_PARAM
public static final int BINARY_STREAM_PARAM
A constant indicating to aRowSetReaderImpl
object that a given parameter is a binary stream. ARowSetReaderImpl
object is provided as an extension of theSyncProvider
abstract class defined in theSyncFactory
static factory SPI mechanism.
See Also:
Constant Field ValuesASCII_STREAM_PARAM
public static final int ASCII_STREAM_PARAM
A constant indicating to aRowSetReaderImpl
object that a given parameter is an ASCII stream. ARowSetReaderImpl
object is provided as an extension of theSyncProvider
abstract class defined in theSyncFactory
static factory SPI mechanism.
See Also:
Constant Field ValuesbinaryStream
The
InputStream
object that will be returned by the methodgetBinaryStream
, which is specified in theResultSet
interface.unicodeStream
The
InputStream
object that will be returned by the methodgetUnicodeStream
, which is specified in theResultSet
interface.asciiStream
The
InputStream
object that will be returned by the methodgetAsciiStream
, which is specified in theResultSet
interface.charStream
protected Reader charStream
TheReader
object that will be returned by the methodgetCharacterStream
, which is specified in theResultSet
interface.Constructor Details
BaseRowSet
public BaseRowSet()
Constructs a newBaseRowSet
object initialized with a defaultVector
object for itslisteners
field. The other default values with which it is initialized are listed in Section 6.0 of the class comment for this class.Method Details
initParams
protected void initParams()
Performs the necessary internal configurations and initializations to allow any JDBCRowSet
implementation to start using the standard facilities provided by aBaseRowSet
instance. This method should be called after theRowSet
object has been instantiated to correctly initialize all parameters. This methodshould never be called by an application, but is called from with aRowSet
implementation extending this class.addRowSetListener
The listener will be notified whenever an event occurs on this
RowSet
object.
A listener might, for example, be a table or graph that needs to be updated in order to accurately reflect the current state of theRowSet
object.
Note: if theRowSetListener
object isnull
, this method silently discards thenull
value and does not add a null reference to the set of listeners.
Note: if the listener is already set, and the newRowSetListener
instance is added to the set of listeners already registered to receive event notifications from thisRowSet
.
Parameters:
listener
- an object that has implemented thejavax.sql.RowSetListener
interface and wants to be notified of any events that occur on thisRowSet
object; May be null.
See Also:
removeRowSetListener(javax.sql.RowSetListener)removeRowSetListener
public void removeRowSetListener(RowSetListener listener)
Removes the designated object from thisRowSet
object's list of listeners. If the given argument is not a registered listener, this method does nothing.Note: if theRowSetListener
object isnull
, this method silently discards thenull
value.
Parameters:
listener
- aRowSetListener
object that is on the list of listeners for thisRowSet
object
See Also:
addRowSetListener(javax.sql.RowSetListener)notifyCursorMoved
protected void notifyCursorMoved() throws SQLException
Notifies all of the listeners registered with thisRowSet
object that its cursor has moved.
When an application calls a method to move the cursor, that method moves the cursor and then calls this method internally. An application should never invoke this method directly.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the class extending theBaseRowSet
abstract class does not implement theRowSet
interface or one of it's sub-interfaces.notifyRowChanged
protected void notifyRowChanged() throws SQLException
Notifies all of the listeners registered with thisRowSet
object that one of its rows has changed.
When an application calls a method that changes a row, such as theCachedRowSet
methodsinsertRow
,updateRow
, ordeleteRow
, that method callsnotifyRowChanged
internally. An application should never invoke this method directly.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the class extending theBaseRowSet
abstract class does not implement theRowSet
interface or one of it's sub-interfaces.notifyRowSetChanged
protected void notifyRowSetChanged() throws SQLException
Notifies all of the listeners registered with thisRowSet
object that its entire contents have changed.
When an application calls methods that change the entire contents of theRowSet
object, such as theCachedRowSet
methodsexecute
,populate
,restoreOriginal
, orrelease
, that method callsnotifyRowSetChanged
internally (either directly or indirectly). An application should never invoke this method directly.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the class extending theBaseRowSet
abstract class does not implement theRowSet
interface or one of it's sub-interfaces.getCommand
public String getCommand()
Retrieves the SQL query that is the command for thisRowSet
object. The command property contains the query that will be executed to populate thisRowSet
object.
The SQL query returned by this method is used byRowSet
methods such asexecute
andpopulate
, which may be implemented by any class that extends theBaseRowSet
abstract class and implements one or more of the standard JSR-114RowSet
interfaces.
The command is used by theRowSet
object's reader to obtain aResultSet
object. The reader then reads the data from theResultSet
object and uses it to to populate thisRowSet
object.
The default value for thecommand
property isnull
.
Returns:
theString
that is the value for thisRowSet
object'scommand
property; may benull
See Also:
setCommand(java.lang.String)setCommand
Sets this
RowSet
object'scommand
property to the givenString
object and clears the parameters, if any, that were set for the previous command.
Thecommand
property may not be needed if theRowSet
object gets its data from a source that does not support commands, such as a spreadsheet or other tabular file. Thus, this property is optional and may benull
.
Parameters:
cmd
- aString
object containing an SQL query that will be set as thisRowSet
object's command property; may benull
but may not be an empty string
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an empty string is provided as the command value
See Also:
getCommand()getUrl
Retrieves the JDBC URL that this
RowSet
object'sjavax.sql.Reader
object uses to make a connection with a relational database using a JDBC technology-enabled driver.
TheUrl
property will benull
if the underlying data source is a non-SQL data source, such as a spreadsheet or an XML data source.
Returns:
aString
object that contains the JDBC URL used to establish the connection for thisRowSet
object; may benull
(default value) if not set
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs retrieving the URL value
See Also:
setUrl(java.lang.String)setUrl
Sets the Url property for this
RowSet
object to the givenString
object and sets the dataSource name property tonull
. The Url property is a JDBC URL that is used when the connection is created using a JDBC technology-enabled driver ("JDBC driver") and theDriverManager
. The correct JDBC URL for the specific driver to be used can be found in the driver documentation. Although there are guidelines for how a JDBC URL is formed, a driver vendor can specify anyString
object except one with a length of0
(an empty string).
Setting the Url property is optional if connections are established using aDataSource
object instead of theDriverManager
. The driver will use either the URL property or the dataSourceName property to create a connection, whichever was specified most recently. If an application uses a JDBC URL, it must load a JDBC driver that accepts the JDBC URL before it uses theRowSet
object to connect to a database. TheRowSet
object will use the URL internally to create a database connection in order to read or write data.
Parameters:
url
- aString
object that contains the JDBC URL that will be used to establish the connection to a database for thisRowSet
object; may benull
but must not be an empty string
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs setting the Url property or the parameter supplied is a string with a length of0
(an empty string)
See Also:
getUrl()getDataSourceName
public String getDataSourceName()
Returns the logical name that when supplied to a naming service that uses the Java Naming and Directory Interface (JNDI) API, will retrieve ajavax.sql.DataSource
object. ThisDataSource
object can be used to establish a connection to the data source that it represents.
Users should set either the url or the data source name property. The driver will use the property set most recently to establish a connection.
Returns:
aString
object that identifies theDataSource
object to be used for making a connection; if no logical name has been set,null
is returned.
See Also:
setDataSourceName(java.lang.String)setDataSourceName
Sets the
DataSource
name property for thisRowSet
object to the given logical name and sets thisRowSet
object's Url property tonull
. The name must have been bound to aDataSource
object in a JNDI naming service so that an application can do a lookup using that name to retrieve theDataSource
object bound to it. TheDataSource
object can then be used to establish a connection to the data source it represents.
Users should set either the Url property or the dataSourceName property. If both properties are set, the driver will use the property set most recently.
Parameters:
name
- aString
object with the name that can be supplied to a naming service based on JNDI technology to retrieve theDataSource
object that can be used to get a connection; may benull
but must not be an empty string
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an empty string is provided as theDataSource
name
See Also:
getDataSourceName()getUsername
public String getUsername()
Returns the user name used to create a database connection. Because it is not serialized, the username property is set at runtime before calling the methodexecute
.
Returns:
theString
object containing the user name that is supplied to the data source to create a connection; may benull
(default value) if not set
See Also:
setUsername(java.lang.String)setUsername
public void setUsername(String name)
Sets the username property for thisRowSet
object to the given user name. Because it is not serialized, the username property is set at run time before calling the methodexecute
.
Parameters:
name
- theString
object containing the user name that is supplied to the data source to create a connection. It may be null.
See Also:
getUsername()getPassword
public String getPassword()
Returns the password used to create a database connection for thisRowSet
object. Because the password property is not serialized, it is set at run time before calling the methodexecute
. The default value isnull
Returns:
theString
object that represents the password that must be supplied to the database to create a connection
See Also:
setPassword(java.lang.String)setPassword
public void setPassword(String pass)
Sets the password used to create a database connection for thisRowSet
object to the givenString
object. Because the password property is not serialized, it is set at run time before calling the methodexecute
.
Parameters:
pass
- theString
object that represents the password that is supplied to the database to create a connection. It may be null.
See Also:
getPassword()setType
public void setType(int type) throws SQLException
Sets the type for thisRowSet
object to the specified type. The default type isResultSet.TYPE_SCROLL_INSENSITIVE
.
Parameters:
type
- one of the following constants:ResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the parameter supplied is not one of the following constants:ResultSet.TYPE_FORWARD_ONLY
orResultSet.TYPE_SCROLL_INSENSITIVE
ResultSet.TYPE_SCROLL_SENSITIVE
See Also:
getConcurrency(), getType()getType
Returns the type of this
RowSet
object. The type is initially determined by the statement that created theRowSet
object. TheRowSet
object can call the methodsetType
at any time to change its type. The default isTYPE_SCROLL_INSENSITIVE
.
Returns:
the type of this JDBCRowSet
object, which must be one of the following:ResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs getting the type of of thisRowSet
object
See Also:
setType(int)setConcurrency
public void setConcurrency(int concurrency) throws SQLException
Sets the concurrency for thisRowSet
object to the specified concurrency. The default concurrency for anyRowSet
object (connected or disconnected) isResultSet.CONCUR_UPDATABLE
, but this method may be called at any time to change the concurrency.
Parameters:
concurrency
- one of the following constants:ResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the parameter supplied is not one of the following constants:ResultSet.CONCUR_UPDATABLE
orResultSet.CONCUR_READ_ONLY
See Also:
getConcurrency(), isReadOnly()isReadOnly
public boolean isReadOnly()
Returns aboolean
indicating whether thisRowSet
object is read-only. Any attempts to update a read-onlyRowSet
object will result in anSQLException
being thrown. By default, rowsets are updatable if updates are possible.
Returns:
true
if thisRowSet
object cannot be updated;false
otherwise
See Also:
setConcurrency(int), setReadOnly(boolean)setReadOnly
public void setReadOnly(boolean value)
Sets thisRowSet
object's readOnly property to the givenboolean
.
Parameters:
value
-true
to indicate that thisRowSet
object is read-only;false
to indicate that it is updatablegetTransactionIsolation
public int getTransactionIsolation()
Returns the transaction isolation property for thisRowSet
object's connection. This property represents the transaction isolation level requested for use in transactions.
ForRowSet
implementations such as theCachedRowSet
that operate in a disconnected environment, theSyncProvider
object offers complementary locking and data integrity options. The options described below are pertinent only to connectedRowSet
objects (JdbcRowSet
objects).
Returns:
one of the following constants:Connection.TRANSACTION_NONE
,Connection.TRANSACTION_READ_UNCOMMITTED
,Connection.TRANSACTION_READ_COMMITTED
,Connection.TRANSACTION_REPEATABLE_READ
, orConnection.TRANSACTION_SERIALIZABLE
See Also:
SyncFactory, SyncProvider, setTransactionIsolation(int)setTransactionIsolation
public void setTransactionIsolation(int level) throws SQLException
Sets the transaction isolation property for this JDBCRowSet
object to the given constant. The DBMS will use this transaction isolation level for transactions if it can.
ForRowSet
implementations such as theCachedRowSet
that operate in a disconnected environment, theSyncProvider
object being used offers complementary locking and data integrity options. The options described below are pertinent only to connectedRowSet
objects (JdbcRowSet
objects).
Parameters:
level
- one of the following constants, listed in ascending order:Connection.TRANSACTION_NONE
,Connection.TRANSACTION_READ_UNCOMMITTED
,Connection.TRANSACTION_READ_COMMITTED
,Connection.TRANSACTION_REPEATABLE_READ
, orConnection.TRANSACTION_SERIALIZABLE
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the given parameter is not one of the Connection constants
See Also:
SyncFactory, SyncProvider, getTransactionIsolation()getTypeMap
Retrieves the type map associated with the
Connection
object for thisRowSet
object.
Drivers that support the JDBC 3.0 API will createConnection
objects with an associated type map. This type map, which is initially empty, can contain one or more fully-qualified SQL names andClass
objects indicating the class to which the named SQL value will be mapped. The type mapping specified in the connection's type map is used for custom type mapping when no other type map supersedes it.
If a type map is explicitly supplied to a method that can perform custom mapping, that type map supersedes the connection's type map.
Returns:
thejava.util.Map
object that is the type map for thisRowSet
object's connectionsetTypeMap
Installs the given
java.util.Map
object as the type map associated with theConnection
object for thisRowSet
object. The custom mapping indicated in this type map will be used unless a different type map is explicitly supplied to a method, in which case the type map supplied will be used.
Parameters:
map
- ajava.util.Map
object that contains the mapping from SQL type names for user defined types (UDT) to classes in the Java programming language. Each entry in theMap
object consists of the fully qualified SQL name of a UDT and theClass
object for theSQLData
implementation of that UDT. May benull
.getMaxFieldSize
Retrieves the maximum number of bytes that can be used for a column value in this
RowSet
object. This limit applies only to columns that hold values of the following types:BINARY
,VARBINARY
,LONGVARBINARY
,CHAR
,VARCHAR
, andLONGVARCHAR
. If the limit is exceeded, the excess data is silently discarded.
Returns:
anint
indicating the current maximum column size limit; zero means that there is no limit
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs internally determining the maximum limit of the column sizesetMaxFieldSize
public void setMaxFieldSize(int max) throws SQLException
Sets the maximum number of bytes that can be used for a column value in thisRowSet
object to the given number. This limit applies only to columns that hold values of the following types:BINARY
,VARBINARY
,LONGVARBINARY
,CHAR
,VARCHAR
, andLONGVARCHAR
. If the limit is exceeded, the excess data is silently discarded. For maximum portability, it is advisable to use values greater than 256.
Parameters:
max
- anint
indicating the new maximum column size limit; zero means that there is no limit
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if (1) an error occurs internally setting the maximum limit of the column size or (2) a size of less than 0 is setgetMaxRows
Retrieves the maximum number of rows that this
RowSet
object may contain. If this limit is exceeded, the excess rows are silently dropped.
Returns:
anint
indicating the current maximum number of rows; zero means that there is no limit
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs internally determining the maximum limit of rows that aRowset
object can containsetMaxRows
public void setMaxRows(int max) throws SQLException
Sets the maximum number of rows that thisRowSet
object may contain to the given number. If this limit is exceeded, the excess rows are silently dropped.
Parameters:
max
- anint
indicating the current maximum number of rows; zero means that there is no limit
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs internally setting the maximum limit on the number of rows that a JDBCRowSet
object can contain; or if max is less than0
; or if max is less than thefetchSize
of theRowSet
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws SQLException
Sets to the givenboolean
whether or not the driver will scan for escape syntax and do escape substitution before sending SQL statements to the database. The default is for the driver to do escape processing.
Note: SincePreparedStatement
objects have usually been parsed prior to making this call, disabling escape processing for prepared statements will likely have no effect.
Parameters:
enable
-true
to enable escape processing;false
to disable it
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs setting the underlying JDBC technology-enabled driver to process the escape syntaxgetQueryTimeout
Retrieves the maximum number of seconds the driver will wait for a query to execute. If the limit is exceeded, an
SQLException
is thrown.
Returns:
the current query timeout limit in seconds; zero means that there is no limit
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs in determining the query time-out valuesetQueryTimeout
public void setQueryTimeout(int seconds) throws SQLException
Sets to the given number the maximum number of seconds the driver will wait for a query to execute. If the limit is exceeded, anSQLException
is thrown.
Parameters:
seconds
- the new query time-out limit in seconds; zero means that there is no limit; must not be less than zero
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs setting the query time-out or if the query time-out value is less than 0getShowDeleted
public boolean getShowDeleted() throws SQLException
Retrieves aboolean
indicating whether rows marked for deletion appear in the set of current rows. The default value isfalse
.
Note: Allowing deleted rows to remain visible complicates the behavior of some of the methods. However, mostRowSet
object users can simply ignore this extra detail because only sophisticated applications will likely want to take advantage of this feature.
Returns:
true
if deleted rows are visible;false
otherwise
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs determining if deleted rows are visible or not
See Also:
setShowDeleted(boolean)setShowDeleted
public void setShowDeleted(boolean value) throws SQLException
Sets the propertyshowDeleted
to the givenboolean
value, which determines whether rows marked for deletion appear in the set of current rows.
Parameters:
value
-true
if deleted rows should be shown;false
otherwise
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs setting whether deleted rows are visible or not
See Also:
getShowDeleted()getEscapeProcessing
public boolean getEscapeProcessing() throws SQLException
Ascertains whether escape processing is enabled for thisRowSet
object.
Returns:
true
if escape processing is turned on;false
otherwise
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs determining if escape processing is enabled or not or if the internal escape processing trigger has not been enabledsetFetchDirection
public void setFetchDirection(int direction) throws SQLException
Gives the driver a performance hint as to the direction in which the rows in thisRowSet
object will be processed. The driver may ignore this hint.
ARowSet
object inherits the default properties of theResultSet
object from which it got its data. ThatResultSet
object's default fetch direction is set by theStatement
object that created it.
This method applies to aRowSet
object only while it is connected to a database using a JDBC driver.
ARowSet
object may use this method at any time to change its setting for the fetch direction.
Parameters:
direction
- one ofResultSet.FETCH_FORWARD
,ResultSet.FETCH_REVERSE
, orResultSet.FETCH_UNKNOWN
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if (1) theRowSet
type isTYPE_FORWARD_ONLY
and the given fetch direction is notFETCH_FORWARD
or (2) the given fetch direction is not one of the following: ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN
See Also:
getFetchDirection()getFetchDirection
public int getFetchDirection() throws SQLException
Retrieves thisRowSet
object's current setting for the fetch direction. The default type isResultSet.FETCH_FORWARD
Returns:
one ofResultSet.FETCH_FORWARD
,ResultSet.FETCH_REVERSE
, orResultSet.FETCH_UNKNOWN
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs in determining the current fetch direction for fetching rows
See Also:
setFetchDirection(int)setFetchSize
public void setFetchSize(int rows) throws SQLException
Sets the fetch size for thisRowSet
object to the given number of rows. The fetch size gives a JDBC technology-enabled driver ("JDBC driver") a hint as to the number of rows that should be fetched from the database when more rows are needed for thisRowSet
object. If the fetch size specified is zero, the driver ignores the value and is free to make its own best guess as to what the fetch size should be.
ARowSet
object inherits the default properties of theResultSet
object from which it got its data. ThatResultSet
object's default fetch size is set by theStatement
object that created it.
This method applies to aRowSet
object only while it is connected to a database using a JDBC driver. For connectedRowSet
implementations such asJdbcRowSet
, this method has a direct and immediate effect on the underlying JDBC driver.
ARowSet
object may use this method at any time to change its setting for the fetch size.
ForRowSet
implementations such asCachedRowSet
, which operate in a disconnected environment, theSyncProvider
object being used may leverage the fetch size to poll the data source and retrieve a number of rows that do not exceed the fetch size and that may form a subset of the actual rows returned by the original query. This is an implementation variance determined by the specificSyncProvider
object employed by the disconnectedRowSet
object.
Parameters:
rows
- the number of rows to fetch;0
to let the driver decide what the best fetch size is; must not be less than0
or more than the maximum number of rows allowed for thisRowSet
object (the number returned by a call to the method getMaxRows())
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the specified fetch size is less than0
or more than the limit for the maximum number of rows
See Also:
getFetchSize()getFetchSize
Returns the fetch size for this
RowSet
object. The default value is zero.
Returns:
the number of rows suggested as the fetch size when thisRowSet
object needs more rows from the database
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs determining the number of rows in the current fetch size
See Also:
setFetchSize(int)getConcurrency
Returns the concurrency for this
RowSet
object. The default isCONCUR_UPDATABLE
for both connected and disconnectedRowSet
objects.
An application can call the methodsetConcurrency
at any time to change aRowSet
object's concurrency.
Returns:
the concurrency type for thisRowSet
object, which must be one of the following:ResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs getting the concurrency of thisRowSet
object
See Also:
setConcurrency(int), isReadOnly()setNull
public void setNull(int parameterIndex, int sqlType) throws SQLException
Sets the designated parameter to SQLNULL
. Note that the parameter's SQL type must be specified using one of the type codes defined injava.sql.Types
. This SQL type is specified in the second parameter.
Note that the second parameter tells the DBMS the data type of the value being set toNULL
. Some DBMSs require this information, so it is required in order to make code more portable.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
after this version ofsetNull
has been called will return anObject
array containing the parameter values that have been set. In that array, the element that represents the values set with this method will itself be an array. The first element of that array isnull
. The second element is the value set for sqlType. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the second placeholder parameter is being set tonull
, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
sqlType
- anint
that is one of the SQL type codes defined in the class Types. If a non-standard_sqlType_ is supplied, this method will not throw aSQLException
. This allows implicit support for non-standard SQL types.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or the given parameter index is out of bounds
See Also:
getParams()setNull
public void setNull(int parameterIndex, int sqlType,String typeName) throws SQLException
Sets the designated parameter to SQLNULL
. Although this version of the methodsetNull
is intended for user-defined andREF
parameters, this method may be used to set a null parameter for any JDBC type. The following are user-defined types:STRUCT
,DISTINCT
, andJAVA_OBJECT
, and named array types.
Note: To be portable, applications must give the SQL type code and the fully qualified SQL type name when specifying aNULL
user-defined orREF
parameter. In the case of a user-defined type, the name is the type name of the parameter itself. For aREF
parameter, the name is the type name of the referenced type. If a JDBC technology-enabled driver does not need the type code or type name information, it may ignore it.
If the parameter does not have a user-defined orREF
type, the giventypeName
parameter is ignored.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
after this version ofsetNull
has been called will return anObject
array containing the parameter values that have been set. In that array, the element that represents the values set with this method will itself be an array. The first element of that array isnull
. The second element is the value set for sqlType, and the third element is the value set for typeName. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the second placeholder parameter is being set tonull
, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
sqlType
- a value fromjava.sql.Types
typeName
- the fully qualified name of an SQL user-defined type, which is ignored if the parameter is not a user-defined type orREF
value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the given parameter index is out of bounds
See Also:
getParams()setBoolean
public void setBoolean(int parameterIndex, boolean x) throws SQLException
Sets the designated parameter to the givenboolean
in the Java programming language. The driver converts this to an SQLBIT
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
,populate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setByte
public void setByte(int parameterIndex, byte x) throws SQLException
Sets the designated parameter to the givenbyte
in the Java programming language. The driver converts this to an SQLTINYINT
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setShort
public void setShort(int parameterIndex, short x) throws SQLException
Sets the designated parameter to the givenshort
in the Java programming language. The driver converts this to an SQLSMALLINT
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setInt
public void setInt(int parameterIndex, int x) throws SQLException
Sets the designated parameter to anint
in the Java programming language. The driver converts this to an SQLINTEGER
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setLong
public void setLong(int parameterIndex, long x) throws SQLException
Sets the designated parameter to the givenlong
in the Java programming language. The driver converts this to an SQLBIGINT
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setFloat
public void setFloat(int parameterIndex, float x) throws SQLException
Sets the designated parameter to the givenfloat
in the Java programming language. The driver converts this to an SQLFLOAT
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setDouble
public void setDouble(int parameterIndex, double x) throws SQLException
Sets the designated parameter to the givendouble
in the Java programming language. The driver converts this to an SQLDOUBLE
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setBigDecimal
Sets the designated parameter to the given
java.lang.BigDecimal
value. The driver converts this to an SQLNUMERIC
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
Note:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setString
Sets the designated parameter to the given
String
value. The driver converts this to an SQLVARCHAR
orLONGVARCHAR
value (depending on the argument's size relative to the driver's limits onVARCHAR
values) when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setBytes
public void setBytes(int parameterIndex, byte[] x) throws SQLException
Sets the designated parameter to the given array of bytes. The driver converts this to an SQLVARBINARY
orLONGVARBINARY
value (depending on the argument's size relative to the driver's limits onVARBINARY
values) when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setDate
public void setDate(int parameterIndex,Date x) throws SQLException
Sets the designated parameter to the givenjava.sql.Date
value. The driver converts this to an SQLDATE
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
after this version ofsetDate
has been called will return an array with the value to be set for placeholder parameter number parameterIndex being theDate
object supplied as the second parameter. Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setTime
public void setTime(int parameterIndex,Time x) throws SQLException
Sets the designated parameter to the givenjava.sql.Time
value. The driver converts this to an SQLTIME
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
after this version of the methodsetTime
has been called will return an array of the parameters that have been set. The parameter to be set for parameter placeholder number parameterIndex will be theTime
object that was set as the second parameter to this method.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- ajava.sql.Time
object, which is to be set as the value for placeholder parameter parameterIndex
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setTimestamp
Sets the designated parameter to the given
java.sql.Timestamp
value. The driver converts this to an SQLTIMESTAMP
value when it sends it to the database.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
after this version ofsetTimestamp
has been called will return an array with the value for parameter placeholder number parameterIndex being theTimestamp
object that was supplied as the second parameter to this method. Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- ajava.sql.Timestamp
object
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setAsciiStream
public void setAsciiStream(int parameterIndex,InputStream x, int length) throws SQLException
Sets the designated parameter to the givenjava.io.InputStream
object, which will have the specified number of bytes. The contents of the stream will be read and sent to the database. This method throws anSQLException
object if the number of bytes read and sent to the database is not equal to length.
When a very large ASCII value is input to aLONGVARCHAR
parameter, it may be more practical to send it via ajava.io.InputStream
object. A JDBC technology-enabled driver will read the data from the stream as needed until it reaches end-of-file. The driver will do any necessary conversion from ASCII to the databaseCHAR
format.
Note: This stream object can be either a standard Java stream object or your own subclass that implements the standard interface.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
Note:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
aftersetAsciiStream
has been called will return an array containing the parameter values that have been set. The element in the array that represents the values set with this method will itself be an array. The first element of that array is the givenjava.io.InputStream
object. The second element is the value set for length. The third element is an internalBaseRowSet
constant specifying that the stream passed to this method is an ASCII stream. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the input stream being set is the value for the second placeholder parameter, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the Java input stream that contains the ASCII parameter value
length
- the number of bytes in the stream. This is the number of bytes the driver will send to the DBMS; lengths of 0 or less are are undefined but will cause an invalid length exception to be thrown in the underlying JDBC driver.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs, the parameter index is out of bounds, or when connected to a data source, the number of bytes the driver reads and sends to the database is not equal to the number of bytes specified in length
See Also:
getParams()setAsciiStream
Sets the designated parameter in this
RowSet
object's command to the given input stream. When a very large ASCII value is input to aLONGVARCHAR
parameter, it may be more practical to send it via ajava.io.InputStream
. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetAsciiStream
which takes a length parameter.
Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...
x
- the Java input stream that contains the ASCII parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedPreparedStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setBinaryStream
public void setBinaryStream(int parameterIndex,InputStream x, int length) throws SQLException
Sets the designated parameter to the givenjava.io.InputStream
object, which will have the specified number of bytes. The contents of the stream will be read and sent to the database. This method throws anSQLException
object if the number of bytes read and sent to the database is not equal to length.
When a very large binary value is input to aLONGVARBINARY
parameter, it may be more practical to send it via ajava.io.InputStream
object. A JDBC technology-enabled driver will read the data from the stream as needed until it reaches end-of-file.
Note: This stream object can be either a standard Java stream object or your own subclass that implements the standard interface.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
aftersetBinaryStream
has been called will return an array containing the parameter values that have been set. In that array, the element that represents the values set with this method will itself be an array. The first element of that array is the givenjava.io.InputStream
object. The second element is the value set for length. The third element is an internalBaseRowSet
constant specifying that the stream passed to this method is a binary stream. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the input stream being set is the value for the second placeholder parameter, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the input stream that contains the binary value to be set
length
- the number of bytes in the stream; lengths of 0 or less are are undefined but will cause an invalid length exception to be thrown in the underlying JDBC driver.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs, the parameter index is out of bounds, or when connected to a data source, the number of bytes the driver reads and sends to the database is not equal to the number of bytes specified in length
See Also:
getParams()setBinaryStream
Sets the designated parameter in this
RowSet
object's command to the given input stream. When a very large binary value is input to aLONGVARBINARY
parameter, it may be more practical to send it via ajava.io.InputStream
object. The data will be read from the stream as needed until end-of-file is reached.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetBinaryStream
which takes a length parameter.
Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...
x
- the java input stream which contains the binary parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedPreparedStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setUnicodeStream
Sets the designated parameter to the given
java.io.InputStream
object, which will have the specified number of bytes. The contents of the stream will be read and sent to the database. This method throws anSQLException
if the number of bytes read and sent to the database is not equal to length.
When a very large Unicode value is input to aLONGVARCHAR
parameter, it may be more practical to send it via ajava.io.InputStream
object. A JDBC technology-enabled driver will read the data from the stream as needed, until it reaches end-of-file. The driver will do any necessary conversion from Unicode to the databaseCHAR
format. The byte format of the Unicode stream must be Java UTF-8, as defined in the Java Virtual Machine Specification.
Note: This stream object can be either a standard Java stream object or your own subclass that implements the standard interface.
This method is deprecated; the methodgetCharacterStream
should be used in its place.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Calls made to the methodgetParams
aftersetUnicodeStream
has been called will return an array containing the parameter values that have been set. In that array, the element that represents the values set with this method will itself be an array. The first element of that array is the givenjava.io.InputStream
object. The second element is the value set for length. The third element is an internalBaseRowSet
constant specifying that the stream passed to this method is a Unicode stream. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the input stream being set is the value for the second placeholder parameter, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- thejava.io.InputStream
object that contains the UNICODE parameter value
length
- the number of bytes in the input stream
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs, the parameter index is out of bounds, or the number of bytes the driver reads and sends to the database is not equal to the number of bytes specified in length
See Also:
getParams()setCharacterStream
public void setCharacterStream(int parameterIndex,Reader reader, int length) throws SQLException
Sets the designated parameter to the givenjava.io.Reader
object, which will have the specified number of characters. The contents of the reader will be read and sent to the database. This method throws anSQLException
if the number of bytes read and sent to the database is not equal to length.
When a very large Unicode value is input to aLONGVARCHAR
parameter, it may be more practical to send it via aReader
object. A JDBC technology-enabled driver will read the data from the stream as needed until it reaches end-of-file. The driver will do any necessary conversion from Unicode to the databaseCHAR
format. The byte format of the Unicode stream must be Java UTF-8, as defined in the Java Virtual Machine Specification.
Note: This stream object can be either a standard Java stream object or your own subclass that implements the standard interface.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
aftersetCharacterStream
has been called will return an array containing the parameter values that have been set. In that array, the element that represents the values set with this method will itself be an array. The first element of that array is the givenjava.io.Reader
object. The second element is the value set for length. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the reader being set is the value for the second placeholder parameter, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
reader
- theReader
object that contains the Unicode data
length
- the number of characters in the stream; lengths of 0 or less are undefined but will cause an invalid length exception to be thrown in the underlying JDBC driver.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs, the parameter index is out of bounds, or when connected to a data source, the number of bytes the driver reads and sends to the database is not equal to the number of bytes specified in length
See Also:
getParams()setCharacterStream
public void setCharacterStream(int parameterIndex,Reader reader) throws SQLException
Sets the designated parameter in thisRowSet
object's command to the givenReader
object. When a very large UNICODE value is input to aLONGVARCHAR
parameter, it may be more practical to send it via ajava.io.Reader
object. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetCharacterStream
which takes a length parameter.
Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...
reader
- thejava.io.Reader
object that contains the Unicode data
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedPreparedStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setObject
public void setObject(int parameterIndex,Object x, int targetSqlType, int scale) throws SQLException
Sets the designated parameter to anObject
in the Java programming language. The second parameter must be anObject
type. For integral values, thejava.lang
equivalent objects should be used. For example, use the classInteger
for anint
.
The driver converts this object to the specified target SQL type before sending it to the database. If the object has a custom mapping (is of a class implementingSQLData
), the driver should call the methodSQLData.writeSQL
to write the object to the SQL data stream. If, on the other hand, the object is of a class implementingRef
,Blob
,Clob
,Struct
, orArray
, the driver should pass it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass database- specific abstract data types.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
after this version ofsetObject
has been called will return an array containing the parameter values that have been set. In that array, the element that represents the values set with this method will itself be an array. The first element of that array is the givenObject
instance, and the second element is the value set for targetSqlType. The third element is the value set for scale, which the driver will ignore if the type of the object being set is notjava.sql.Types.NUMERIC
orjava.sql.Types.DECIMAL
. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the object being set is the value for the second placeholder parameter, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- theObject
containing the input parameter value; must be anObject
type
targetSqlType
- the SQL type (as defined injava.sql.Types
) to be sent to the database. Thescale
argument may further qualify this type. If a non-standard targetSqlType is supplied, this method will not throw aSQLException
. This allows implicit support for non-standard SQL types.
scale
- for the typesjava.sql.Types.DECIMAL
andjava.sql.Types.NUMERIC
, this is the number of digits after the decimal point. For all other types, this value will be ignored.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setObject
public void setObject(int parameterIndex,Object x, int targetSqlType) throws SQLException
Sets the value of the designated parameter with the givenObject
value. This method is likesetObject(int parameterIndex, Object x, int targetSqlType, int scale)
except that it assumes a scale of zero.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
after this version ofsetObject
has been called will return an array containing the parameter values that have been set. In that array, the element that represents the values set with this method will itself be an array. The first element of that array is the givenObject
instance. The second element is the value set for targetSqlType. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the object being set is the value for the second placeholder parameter, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- theObject
containing the input parameter value; must be anObject
type
targetSqlType
- the SQL type (as defined injava.sql.Types
) to be sent to the database. If a non-standard targetSqlType is supplied, this method will not throw aSQLException
. This allows implicit support for non-standard SQL types.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setObject
Sets the designated parameter to an
Object
in the Java programming language. The second parameter must be anObject
type. For integral values, thejava.lang
equivalent objects should be used. For example, use the classInteger
for anint
.
The JDBC specification defines a standard mapping from JavaObject
types to SQL types. The driver will use this standard mapping to convert the given object to its corresponding SQL type before sending it to the database. If the object has a custom mapping (is of a class implementingSQLData
), the driver should call the methodSQLData.writeSQL
to write the object to the SQL data stream.
If, on the other hand, the object is of a class implementingRef
,Blob
,Clob
,Struct
, orArray
, the driver should pass it to the database as a value of the corresponding SQL type.
This method throws an exception if there is an ambiguity, for example, if the object is of a class implementing more than one interface.
Note that this method may be used to pass database-specific abstract data types.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
After this method has been called, a call to the methodgetParams
will return an object array of the current command parameters, which will include theObject
set for placeholder parameter numberparameterIndex
. Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- the object containing the input parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs the parameter index is out of bounds, or there is ambiguity in the implementation of the object being set
See Also:
getParams()setRef
public void setRef(int parameterIndex,Ref ref) throws SQLException
Sets the designated parameter to the givenRef
object in the Java programming language. The driver converts this to an SQLREF
value when it sends it to the database. Internally, theRef
is represented as aSerialRef
to ensure serializability.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
After this method has been called, a call to the methodgetParams
will return an object array of the current command parameters, which will include theRef
object set for placeholder parameter numberparameterIndex
. Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
ref
- aRef
object representing an SQLREF
value; cannot be null
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs; the parameter index is out of bounds or theRef
object isnull
; or theRef
object returns anull
base type name.
See Also:
getParams(), SerialRefsetBlob
public void setBlob(int parameterIndex,Blob x) throws SQLException
Sets the designated parameter to the givenBlob
object in the Java programming language. The driver converts this to an SQLBLOB
value when it sends it to the database. Internally, theBlob
is represented as aSerialBlob
to ensure serializability.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces. NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
After this method has been called, a call to the methodgetParams
will return an object array of the current command parameters, which will include theBlob
object set for placeholder parameter numberparameterIndex
. Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- aBlob
object representing an SQLBLOB
value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams(), SerialBlobsetClob
public void setClob(int parameterIndex,Clob x) throws SQLException
Sets the designated parameter to the givenClob
object in the Java programming language. The driver converts this to an SQLCLOB
value when it sends it to the database. Internally, theClob
is represented as aSerialClob
to ensure serializability.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
After this method has been called, a call to the methodgetParams
will return an object array of the current command parameters, which will include theClob
object set for placeholder parameter numberparameterIndex
. Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- aClob
object representing an SQLCLOB
value; cannot be null
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs; the parameter index is out of bounds or theClob
is null
See Also:
getParams(), SerialBlobsetArray
public void setArray(int parameterIndex,Array array) throws SQLException
Sets the designated parameter to anArray
object in the Java programming language. The driver converts this to an SQLARRAY
value when it sends it to the database. Internally, theArray
is represented as aSerialArray
to ensure serializability.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
Note:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
After this method has been called, a call to the methodgetParams
will return an object array of the current command parameters, which will include theArray
object set for placeholder parameter numberparameterIndex
. Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is element number parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
array
- anArray
object representing an SQLARRAY
value; cannot be null. TheArray
object passed to this method must return a non-null Object for allgetArray()
method calls. A null value will cause aSQLException
to be thrown.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs; the parameter index is out of bounds or theARRAY
is null
See Also:
getParams(), SerialArraysetDate
Sets the designated parameter to the given
java.sql.Date
object. When the DBMS does not store time zone information, the driver will use the givenCalendar
object to construct the SQLDATE
value to send to the database. With aCalendar
object, the driver can calculate the date taking into account a custom time zone. If noCalendar
object is specified, the driver uses the time zone of the Virtual Machine that is running the application.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
after this version ofsetDate
has been called will return an array containing the parameter values that have been set. In that array, the element that represents the values set with this method will itself be an array. The first element of that array is the givenjava.sql.Date
object. The second element is the value set for cal. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the date being set is the value for the second placeholder parameter, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- ajava.sql.Date
object representing an SQLDATE
value
cal
- ajava.util.Calendar
object to use when when constructing the date
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setTime
Sets the designated parameter to the given
java.sql.Time
object. The driver converts this to an SQLTIME
value when it sends it to the database.
When the DBMS does not store time zone information, the driver will use the givenCalendar
object to construct the SQLTIME
value to send to the database. With aCalendar
object, the driver can calculate the date taking into account a custom time zone. If noCalendar
object is specified, the driver uses the time zone of the Virtual Machine that is running the application.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
after this version ofsetTime
has been called will return an array containing the parameter values that have been set. In that array, the element that represents the values set with this method will itself be an array. The first element of that array is the givenjava.sql.Time
object. The second element is the value set for cal. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the time being set is the value for the second placeholder parameter, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- ajava.sql.Time
object
cal
- thejava.util.Calendar
object the driver can use to construct the time
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()setTimestamp
Sets the designated parameter to the given
java.sql.Timestamp
object. The driver converts this to an SQLTIMESTAMP
value when it sends it to the database.
When the DBMS does not store time zone information, the driver will use the givenCalendar
object to construct the SQLTIMESTAMP
value to send to the database. With aCalendar
object, the driver can calculate the timestamp taking into account a custom time zone. If noCalendar
object is specified, the driver uses the time zone of the Virtual Machine that is running the application.
The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in thisRowSet
object's command when the methodexecute
is called. Methods such asexecute
andpopulate
must be provided in any class that extends this class and implements one or more of the standard JSR-114RowSet
interfaces.
NOTE:JdbcRowSet
does not require thepopulate
method as it is undefined in this class.
Calls made to the methodgetParams
after this version ofsetTimestamp
has been called will return an array containing the parameter values that have been set. In that array, the element that represents the values set with this method will itself be an array. The first element of that array is the givenjava.sql.Timestamp
object. The second element is the value set for cal. The parameter number is indicated by an element's position in the array returned by the methodgetParams
, with the first element being the value for the first placeholder parameter, the second element being the value for the second placeholder parameter, and so on. In other words, if the timestamp being set is the value for the second placeholder parameter, the array containing it will be the second element in the array returned bygetParams
.
Note that because the numbering of elements in an array starts at zero, the array element that corresponds to placeholder parameter number_parameterIndex_ is parameterIndex -1.
Parameters:
parameterIndex
- the ordinal number of the placeholder parameter in thisRowSet
object's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1
or greater
x
- ajava.sql.Timestamp
object
cal
- thejava.util.Calendar
object the driver can use to construct the timestamp
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs or the parameter index is out of bounds
See Also:
getParams()clearParameters
public void clearParameters() throws SQLException
Clears all of the current parameter values in thisRowSet
object's internal representation of the parameters to be set in thisRowSet
object's command when it is executed.
In general, parameter values remain in force for repeated use in thisRowSet
object's command. Setting a parameter value with the setter methods automatically clears the value of the designated parameter and replaces it with the new specified value.
This method is called internally by thesetCommand
method to clear all of the parameters set for the previous command.
Furthermore, this method differs from theinitParams
method in that it maintains the schema of theRowSet
object.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs clearing the parametersgetParams
Retrieves an array containing the parameter values (both Objects and primitives) that have been set for this
RowSet
object's command and throws anSQLException
object if all parameters have not been set. Before the command is sent to the DBMS to be executed, these parameters will be substituted for placeholder parameters in thePreparedStatement
object that is the command for aRowSet
implementation extending theBaseRowSet
class.
Each element in the array that is returned is anObject
instance that contains the values of the parameters supplied to a setter method. The order of the elements is determined by the value supplied for_parameterIndex_. If the setter method takes only the parameter index and the value to be set (possibly null), the array element will contain the value to be set (which will be expressed as anObject
). If there are additional parameters, the array element will itself be an array containing the value to be set plus any additional parameter values supplied to the setter method. If the method sets a stream, the array element includes the type of stream being supplied to the method. These additional parameters are for the use of the driver or the DBMS and may or may not be used.
NOTE: Stored parameter values of typesArray
,Blob
,Clob
andRef
are returned asSerialArray
,SerialBlob
,SerialClob
andSerialRef
respectively.
Returns:
an array ofObject
instances that includes the parameter values that may be set in thisRowSet
object's command; an empty array if no parameters have been set
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if an error occurs retrieving the object array of parameters of thisRowSet
object or if not all parameters have been setsetNull
public void setNull(String parameterName, int sqlType) throws SQLException
Sets the designated parameter to SQLNULL
.
Note: You must specify the parameter's SQL type.
Parameters:
parameterName
- the name of the parameter
sqlType
- the SQL type code defined injava.sql.Types
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this methodsetNull
Sets the designated parameter to SQL
NULL
. This version of the methodsetNull
should be used for user-defined types and REF type parameters. Examples of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and named array types.
Note: To be portable, applications must give the SQL type code and the fully-qualified SQL type name when specifying a NULL user-defined or REF parameter. In the case of a user-defined type the name is the type name of the parameter itself. For a REF parameter, the name is the type name of the referenced type. If a JDBC driver does not need the type code or type name information, it may ignore it. Although it is intended for user-defined and Ref parameters, this method may be used to set a null parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the given typeName is ignored.
Parameters:
parameterName
- the name of the parameter
sqlType
- a value fromjava.sql.Types
typeName
- the fully-qualified name of an SQL user-defined type; ignored if the parameter is not a user-defined type or SQLREF
value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this methodsetBoolean
public void setBoolean(String parameterName, boolean x) throws SQLException
Sets the designated parameter to the given Javaboolean
value. The driver converts this to an SQLBIT
orBOOLEAN
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setByte
Sets the designated parameter to the given Java
byte
value. The driver converts this to an SQLTINYINT
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setShort
Sets the designated parameter to the given Java
short
value. The driver converts this to an SQLSMALLINT
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setInt
Sets the designated parameter to the given Java
int
value. The driver converts this to an SQLINTEGER
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setLong
Sets the designated parameter to the given Java
long
value. The driver converts this to an SQLBIGINT
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setFloat
Sets the designated parameter to the given Java
float
value. The driver converts this to an SQLFLOAT
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setDouble
public void setDouble(String parameterName, double x) throws SQLException
Sets the designated parameter to the given Javadouble
value. The driver converts this to an SQLDOUBLE
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setBigDecimal
Sets the designated parameter to the given
java.math.BigDecimal
value. The driver converts this to an SQLNUMERIC
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setString
Sets the designated parameter to the given Java
String
value. The driver converts this to an SQLVARCHAR
orLONGVARCHAR
value (depending on the argument's size relative to the driver's limits onVARCHAR
values) when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setBytes
public void setBytes(String parameterName, byte[] x) throws SQLException
Sets the designated parameter to the given Java array of bytes. The driver converts this to an SQLVARBINARY
orLONGVARBINARY
(depending on the argument's size relative to the driver's limits onVARBINARY
values) when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setTimestamp
Sets the designated parameter to the given
java.sql.Timestamp
value. The driver converts this to an SQLTIMESTAMP
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setAsciiStream
Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large ASCII value is input to a
LONGVARCHAR
parameter, it may be more practical to send it via ajava.io.InputStream
. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Parameters:
parameterName
- the name of the parameter
x
- the Java input stream that contains the ASCII parameter value
length
- the number of bytes in the stream
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this methodsetBinaryStream
Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large binary value is input to a
LONGVARBINARY
parameter, it may be more practical to send it via ajava.io.InputStream
object. The data will be read from the stream as needed until end-of-file is reached.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Parameters:
parameterName
- the name of the parameter
x
- the java input stream which contains the binary parameter value
length
- the number of bytes in the stream
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this methodsetCharacterStream
public void setCharacterStream(String parameterName,Reader reader, int length) throws SQLException
Sets the designated parameter to the givenReader
object, which is the given number of characters long. When a very large UNICODE value is input to aLONGVARCHAR
parameter, it may be more practical to send it via ajava.io.Reader
object. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Parameters:
parameterName
- the name of the parameter
reader
- thejava.io.Reader
object that contains the UNICODE data used as the designated parameter
length
- the number of characters in the stream
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this methodsetAsciiStream
Sets the designated parameter to the given input stream. When a very large ASCII value is input to a
LONGVARCHAR
parameter, it may be more practical to send it via ajava.io.InputStream
. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetAsciiStream
which takes a length parameter.
Parameters:
parameterName
- the name of the parameter
x
- the Java input stream that contains the ASCII parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setBinaryStream
Sets the designated parameter to the given input stream. When a very large binary value is input to a
LONGVARBINARY
parameter, it may be more practical to send it via ajava.io.InputStream
object. The data will be read from the stream as needed until end-of-file is reached.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetBinaryStream
which takes a length parameter.
Parameters:
parameterName
- the name of the parameter
x
- the java input stream which contains the binary parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setCharacterStream
Sets the designated parameter to the given
Reader
object. When a very large UNICODE value is input to aLONGVARCHAR
parameter, it may be more practical to send it via ajava.io.Reader
object. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetCharacterStream
which takes a length parameter.
Parameters:
parameterName
- the name of the parameter
reader
- thejava.io.Reader
object that contains the Unicode data
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNCharacterStream
public void setNCharacterStream(int parameterIndex,Reader value) throws SQLException
Sets the designated parameter in thisRowSet
object's command to aReader
object. TheReader
reads the data till end-of-file is reached. The driver does the necessary conversion from Java character format to the national character set in the database.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetNCharacterStream
which takes a length parameter.
Parameters:
parameterIndex
- of the first parameter is 1, the second is 2, ...
value
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the driver does not support national character sets; if the driver can detect that a data conversion error could occur ; if a database access error occurs; or this method is called on a closedPreparedStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setObject
public void setObject(String parameterName,Object x, int targetSqlType, int scale) throws SQLException
Sets the value of the designated parameter with the given object. The second argument must be an object type; for integral values, thejava.lang
equivalent objects should be used.
The given Java object will be converted to the given targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing the interfaceSQLData
), the JDBC driver should call the methodSQLData.writeSQL
to write it to the SQL data stream. If, on the other hand, the object is of a class implementingRef
,Blob
,Clob
,NClob
,Struct
,java.net.URL
, orArray
, the driver should pass it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass database- specific abstract data types.
Parameters:
parameterName
- the name of the parameter
x
- the object containing the input parameter value
targetSqlType
- the SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.
scale
- for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, this is the number of digits after the decimal point. For all other types, this value will be ignored.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- iftargetSqlType
is aARRAY
,BLOB
,CLOB
,DATALINK
,JAVA_OBJECT
,NCHAR
,NCLOB
,NVARCHAR
,LONGNVARCHAR
,REF
,ROWID
,SQLXML
orSTRUCT
data type and the JDBC driver does not support this data type
See Also:
Types, getParams()setObject
Sets the value of the designated parameter with the given object. This method is like the method
setObject
above, except that it assumes a scale of zero.
Parameters:
parameterName
- the name of the parameter
x
- the object containing the input parameter value
targetSqlType
- the SQL type (as defined in java.sql.Types) to be sent to the database
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- iftargetSqlType
is aARRAY
,BLOB
,CLOB
,DATALINK
,JAVA_OBJECT
,NCHAR
,NCLOB
,NVARCHAR
,LONGNVARCHAR
,REF
,ROWID
,SQLXML
orSTRUCT
data type and the JDBC driver does not support this data type
See Also:
getParams()setObject
Sets the value of the designated parameter with the given object. The second parameter must be of type
Object
; therefore, thejava.lang
equivalent objects should be used for built-in types.
The JDBC specification specifies a standard mapping from JavaObject
types to SQL types. The given argument will be converted to the corresponding SQL type before being sent to the database.
Note that this method may be used to pass database- specific abstract data types, by using a driver-specific Java type. If the object is of a class implementing the interfaceSQLData
, the JDBC driver should call the methodSQLData.writeSQL
to write it to the SQL data stream. If, on the other hand, the object is of a class implementingRef
,Blob
,Clob
,NClob
,Struct
,java.net.URL
, orArray
, the driver should pass it to the database as a value of the corresponding SQL type.
This method throws an exception if there is an ambiguity, for example, if the object is of a class implementing more than one of the interfaces named above.
Parameters:
parameterName
- the name of the parameter
x
- the object containing the input parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs, this method is called on a closedCallableStatement
or if the givenObject
parameter is ambiguous
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setBlob
public void setBlob(int parameterIndex,InputStream inputStream, long length) throws SQLException
Sets the designated parameter to aInputStream
object. TheInputStream
must contain the number of characters specified by length otherwise aSQLException
will be generated when thePreparedStatement
is executed. This method differs from thesetBinaryStream (int, InputStream, int)
method because it informs the driver that the parameter value should be sent to the server as aBLOB
. When thesetBinaryStream
method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARBINARY
or aBLOB
Parameters:
parameterIndex
- index of the first parameter is 1, the second is 2, ...
inputStream
- An object that contains the data to set the parameter value to.
length
- the number of bytes in the parameter data.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs, this method is called on a closedPreparedStatement
, if parameterIndex does not correspond to a parameter marker in the SQL statement, if the length specified is less than zero or if the number of bytes in theInputStream
does not match the specified length.
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setBlob
Sets the designated parameter to a
InputStream
object. This method differs from thesetBinaryStream (int, InputStream)
method because it informs the driver that the parameter value should be sent to the server as aBLOB
. When thesetBinaryStream
method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARBINARY
or aBLOB
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetBlob
which takes a length parameter.
Parameters:
parameterIndex
- index of the first parameter is 1, the second is 2, ...
inputStream
- An object that contains the data to set the parameter value to.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs, this method is called on a closedPreparedStatement
or if parameterIndex does not correspond to a parameter marker in the SQL statement,
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setBlob
Sets the designated parameter to a
InputStream
object. TheInputstream
must contain the number of characters specified by length, otherwise aSQLException
will be generated when theCallableStatement
is executed. This method differs from thesetBinaryStream (int, InputStream, int)
method because it informs the driver that the parameter value should be sent to the server as aBLOB
. When thesetBinaryStream
method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARBINARY
or aBLOB
Parameters:
parameterName
- the name of the parameter to be set the second is 2, ...
inputStream
- An object that contains the data to set the parameter value to.
length
- the number of bytes in the parameter data.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if parameterIndex does not correspond to a parameter marker in the SQL statement, or if the length specified is less than zero; if the number of bytes in theInputStream
does not match the specified length; if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setBlob
Sets the designated parameter to the given
java.sql.Blob
object. The driver converts this to an SQLBLOB
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- aBlob
object that maps an SQLBLOB
value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setBlob
Sets the designated parameter to a
InputStream
object. This method differs from thesetBinaryStream (int, InputStream)
method because it informs the driver that the parameter value should be sent to the server as aBLOB
. When thesetBinaryStream
method is used, the driver may have to do extra work to determine whether the parameter data should be send to the server as aLONGVARBINARY
or aBLOB
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetBlob
which takes a length parameter.
Parameters:
parameterName
- the name of the parameter
inputStream
- An object that contains the data to set the parameter value to.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setClob
public void setClob(int parameterIndex,Reader reader, long length) throws SQLException
Sets the designated parameter to aReader
object. The reader must contain the number of characters specified by length otherwise aSQLException
will be generated when thePreparedStatement
is executed. This method differs from thesetCharacterStream (int, Reader, int)
method because it informs the driver that the parameter value should be sent to the server as aCLOB
. When thesetCharacterStream
method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARCHAR
or aCLOB
Parameters:
parameterIndex
- index of the first parameter is 1, the second is 2, ...
reader
- An object that contains the data to set the parameter value to.
length
- the number of characters in the parameter data.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs, this method is called on a closedPreparedStatement
, if parameterIndex does not correspond to a parameter marker in the SQL statement, or if the length specified is less than zero.
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setClob
public void setClob(int parameterIndex,Reader reader) throws SQLException
Sets the designated parameter to aReader
object. This method differs from thesetCharacterStream (int, Reader)
method because it informs the driver that the parameter value should be sent to the server as aCLOB
. When thesetCharacterStream
method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARCHAR
or aCLOB
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetClob
which takes a length parameter.
Parameters:
parameterIndex
- index of the first parameter is 1, the second is 2, ...
reader
- An object that contains the data to set the parameter value to.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs, this method is called on a closedPreparedStatement
or if parameterIndex does not correspond to a parameter marker in the SQL statement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setClob
Sets the designated parameter to a
Reader
object. Thereader
must contain the number of characters specified by length otherwise aSQLException
will be generated when theCallableStatement
is executed. This method differs from thesetCharacterStream (int, Reader, int)
method because it informs the driver that the parameter value should be sent to the server as aCLOB
. When thesetCharacterStream
method is used, the driver may have to do extra work to determine whether the parameter data should be send to the server as aLONGVARCHAR
or aCLOB
Parameters:
parameterName
- the name of the parameter to be set
reader
- An object that contains the data to set the parameter value to.
length
- the number of characters in the parameter data.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if parameterIndex does not correspond to a parameter marker in the SQL statement; if the length specified is less than zero; a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setClob
Sets the designated parameter to the given
java.sql.Clob
object. The driver converts this to an SQLCLOB
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- aClob
object that maps an SQLCLOB
value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setClob
Sets the designated parameter to a
Reader
object. This method differs from thesetCharacterStream (int, Reader)
method because it informs the driver that the parameter value should be sent to the server as aCLOB
. When thesetCharacterStream
method is used, the driver may have to do extra work to determine whether the parameter data should be send to the server as aLONGVARCHAR
or aCLOB
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetClob
which takes a length parameter.
Parameters:
parameterName
- the name of the parameter
reader
- An object that contains the data to set the parameter value to.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setDate
Sets the designated parameter to the given
java.sql.Date
value using the default time zone of the virtual machine that is running the application. The driver converts this to an SQLDATE
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setDate
Sets the designated parameter to the given
java.sql.Date
value, using the givenCalendar
object. The driver uses theCalendar
object to construct an SQLDATE
value, which the driver then sends to the database. With a aCalendar
object, the driver can calculate the date taking into account a custom timezone. If noCalendar
object is specified, the driver uses the default timezone, which is that of the virtual machine running the application.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
cal
- theCalendar
object the driver will use to construct the date
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setTime
Sets the designated parameter to the given
java.sql.Time
value. The driver converts this to an SQLTIME
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setTime
Sets the designated parameter to the given
java.sql.Time
value, using the givenCalendar
object. The driver uses theCalendar
object to construct an SQLTIME
value, which the driver then sends to the database. With a aCalendar
object, the driver can calculate the time taking into account a custom timezone. If noCalendar
object is specified, the driver uses the default timezone, which is that of the virtual machine running the application.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
cal
- theCalendar
object the driver will use to construct the time
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setTimestamp
Sets the designated parameter to the given
java.sql.Timestamp
value, using the givenCalendar
object. The driver uses theCalendar
object to construct an SQLTIMESTAMP
value, which the driver then sends to the database. With a aCalendar
object, the driver can calculate the timestamp taking into account a custom timezone. If noCalendar
object is specified, the driver uses the default timezone, which is that of the virtual machine running the application.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
cal
- theCalendar
object the driver will use to construct the timestamp
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
See Also:
getParams()setSQLXML
public void setSQLXML(int parameterIndex,SQLXML xmlObject) throws SQLException
Sets the designated parameter to the givenjava.sql.SQLXML
object. The driver converts this to an SQLXML
value when it sends it to the database.
Parameters:
parameterIndex
- index of the first parameter is 1, the second is 2, ...
xmlObject
- aSQLXML
object that maps an SQLXML
value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs, this method is called on a closed result set, thejava.xml.transform.Result
,Writer
orOutputStream
has not been closed for theSQLXML
object or if there is an error processing the XML value. ThegetCause
method of the exception may provide a more detailed exception, for example, if the stream does not contain valid XML.
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setSQLXML
Sets the designated parameter to the given
java.sql.SQLXML
object. The driver converts this to anSQL XML
value when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
xmlObject
- aSQLXML
object that maps anSQL XML
value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs, this method is called on a closed result set, thejava.xml.transform.Result
,Writer
orOutputStream
has not been closed for theSQLXML
object or if there is an error processing the XML value. ThegetCause
method of the exception may provide a more detailed exception, for example, if the stream does not contain valid XML.
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setRowId
public void setRowId(int parameterIndex,RowId x) throws SQLException
Sets the designated parameter to the givenjava.sql.RowId
object. The driver converts this to a SQLROWID
value when it sends it to the database
Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setRowId
Sets the designated parameter to the given
java.sql.RowId
object. The driver converts this to a SQLROWID
when it sends it to the database.
Parameters:
parameterName
- the name of the parameter
x
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNString
public void setNString(int parameterIndex,String value) throws SQLException
Sets the designated parameter to the givenString
object. The driver converts this to a SQLNCHAR
orNVARCHAR
orLONGNVARCHAR
value (depending on the argument's size relative to the driver's limits onNVARCHAR
values) when it sends it to the database.
Parameters:
parameterIndex
- of the first parameter is 1, the second is 2, ...
value
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the driver does not support national character sets; if the driver can detect that a data conversion error could occur ; or if a database access error occurs
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNString
Sets the designated parameter to the given
String
object. The driver converts this to a SQLNCHAR
orNVARCHAR
orLONGNVARCHAR
Parameters:
parameterName
- the name of the column to be set
value
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; or if a database access error occurs
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNCharacterStream
public void setNCharacterStream(int parameterIndex,Reader value, long length) throws SQLException
Sets the designated parameter to aReader
object. TheReader
reads the data till end-of-file is reached. The driver does the necessary conversion from Java character format to the national character set in the database.
Parameters:
parameterIndex
- of the first parameter is 1, the second is 2, ...
value
- the parameter value
length
- the number of characters in the parameter data.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the driver does not support national character sets; if the driver can detect that a data conversion error could occur ; or if a database access error occurs
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNCharacterStream
public void setNCharacterStream(String parameterName,Reader value, long length) throws SQLException
Sets the designated parameter to aReader
object. TheReader
reads the data till end-of-file is reached. The driver does the necessary conversion from Java character format to the national character set in the database.
Parameters:
parameterName
- the name of the column to be set
value
- the parameter value
length
- the number of characters in the parameter data.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; or if a database access error occurs
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNCharacterStream
Sets the designated parameter to a
Reader
object. TheReader
reads the data till end-of-file is reached. The driver does the necessary conversion from Java character format to the national character set in the database.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetNCharacterStream
which takes a length parameter.
Parameters:
parameterName
- the name of the parameter
value
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the driver does not support national character sets; if the driver can detect that a data conversion error could occur ; if a database access error occurs; or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNClob
Sets the designated parameter to a
java.sql.NClob
object. The object implements thejava.sql.NClob
interface. ThisNClob
object maps to a SQLNCLOB
.
Parameters:
parameterName
- the name of the column to be set
value
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; or if a database access error occurs
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNClob
Sets the designated parameter to a
Reader
object. Thereader
must contain the number of characters specified by length otherwise aSQLException
will be generated when theCallableStatement
is executed. This method differs from thesetCharacterStream (int, Reader, int)
method because it informs the driver that the parameter value should be sent to the server as aNCLOB
. When thesetCharacterStream
method is used, the driver may have to do extra work to determine whether the parameter data should be send to the server as aLONGNVARCHAR
or aNCLOB
Parameters:
parameterName
- the name of the parameter to be set
reader
- An object that contains the data to set the parameter value to.
length
- the number of characters in the parameter data.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if parameterIndex does not correspond to a parameter marker in the SQL statement; if the length specified is less than zero; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNClob
Sets the designated parameter to a
Reader
object. This method differs from thesetCharacterStream (int, Reader)
method because it informs the driver that the parameter value should be sent to the server as aNCLOB
. When thesetCharacterStream
method is used, the driver may have to do extra work to determine whether the parameter data should be send to the server as aLONGNVARCHAR
or aNCLOB
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetNClob
which takes a length parameter.
Parameters:
parameterName
- the name of the parameter
reader
- An object that contains the data to set the parameter value to.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs or this method is called on a closedCallableStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNClob
public void setNClob(int parameterIndex,Reader reader, long length) throws SQLException
Sets the designated parameter to aReader
object. The reader must contain the number of characters specified by length otherwise aSQLException
will be generated when thePreparedStatement
is executed. This method differs from thesetCharacterStream (int, Reader, int)
method because it informs the driver that the parameter value should be sent to the server as aNCLOB
. When thesetCharacterStream
method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGNVARCHAR
or aNCLOB
Parameters:
parameterIndex
- index of the first parameter is 1, the second is 2, ...
reader
- An object that contains the data to set the parameter value to.
length
- the number of characters in the parameter data.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if parameterIndex does not correspond to a parameter marker in the SQL statement; if the length specified is less than zero; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs or this method is called on a closedPreparedStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNClob
public void setNClob(int parameterIndex,NClob value) throws SQLException
Sets the designated parameter to ajava.sql.NClob
object. The driver converts this oa SQLNCLOB
value when it sends it to the database.
Parameters:
parameterIndex
- of the first parameter is 1, the second is 2, ...
value
- the parameter value
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if the driver does not support national character sets; if the driver can detect that a data conversion error could occur ; or if a database access error occurs
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setNClob
public void setNClob(int parameterIndex,Reader reader) throws SQLException
Sets the designated parameter to aReader
object. This method differs from thesetCharacterStream (int, Reader)
method because it informs the driver that the parameter value should be sent to the server as aNCLOB
. When thesetCharacterStream
method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGNVARCHAR
or aNCLOB
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version ofsetNClob
which takes a length parameter.
Parameters:
parameterIndex
- index of the first parameter is 1, the second is 2, ...
reader
- An object that contains the data to set the parameter value to.
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if parameterIndex does not correspond to a parameter marker in the SQL statement; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs or this method is called on a closedPreparedStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method
Since:
1.6setURL
public void setURL(int parameterIndex,URL x) throws SQLException
Sets the designated parameter to the givenjava.net.URL
value. The driver converts this to an SQLDATALINK
value when it sends it to the database.
Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...
x
- thejava.net.URL
object to be set
Throws:
[SQLException](../../../../java.sql/java/sql/SQLException.html "class in java.sql")
- if a database access error occurs or this method is called on a closedPreparedStatement
[SQLFeatureNotSupportedException](../../../../java.sql/java/sql/SQLFeatureNotSupportedException.html "class in java.sql")
- if the JDBC driver does not support this method