- java.lang.Object
-
- javax.sql.rowset.BaseRowSet
-
- All Implemented Interfaces:
Serializable,Cloneable
public abstract class BaseRowSet extends Object implements Serializable, Cloneable
An abstract class providing aRowSetobject with its basic functionality. The basic functions include having properties and sending event notifications, which all JavaBeans™ components must implement.1.0 Overview
TheBaseRowSetclass provides the core functionality for allRowSetimplementations, and all standard implementations may use this class in combination with one or moreRowSetinterfaces in order to provide a standard vendor-specific implementation. To clarify, all implementations must implement at least one of theRowSetinterfaces (JdbcRowSet,CachedRowSet,JoinRowSet,FilteredRowSet, orWebRowSet). This means that any implementation that extends theBaseRowSetclass must also implement one of theRowSetinterfaces.The
BaseRowSetclass 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
RowSetobject'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 theRowSetimplementation does and how it gets its data. For example, rowsets that get their data from aResultSetobject need to set the properties that are required for making a database connection. If aRowSetobject uses theDriverManagerfacility 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 aDataSourceobject 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
DataSourceobject for making a connection, theDataSourceobject 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 aResultSetobject. This query is the command that is set for theRowSetobject's command property. The rowset populates itself with data by reading the data from theResultSetobject into itself. If the query contains placeholders for values to be set, theBaseRowSetsetter methods are used to set these values. All setter methods allow these values to be set tonullif required.The following code fragment illustrates how the
CachedRowSet™ objectcrsmight 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_LIMITandREGIONare 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, theBaseRowSetclass provides a set of setter methods, similar to those provided by thePreparedStatementinterface, for setting values of each data type. ARowSetobject stores the parameter values internally, and itsexecutemethod 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.
If thecrs.setInt(1, 5000); crs.setString(2, "West");executemethod is called at this point, the query sent to the DBMS will be:
NOTE: Setting"SELECT FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMERS" + "WHERE CREDIT_LIMIT > 5000 AND REGION = 'West'"Array,Clob,BlobandRefobjects as a command parameter, stores these values asSerialArray,SerialClob,SerialBlobandSerialRefobjects respectively.4.0 Handling of Parameters Behind the Scenes
NOTE: TheBaseRowSetclass 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
BaseRowSetsetter methods are stored as objects in an internalHashtableobject. Primitives are stored as theirObjecttype. For example,byteis stored asByteobject, andintis stored as anIntegerobject. When the methodexecuteis called, the values in theHashtableobject are substituted for the appropriate placeholder parameters in the command.A call to the method
getParamsreturns the values stored in theHashtableobject as an array ofObjectinstances. An element in this array may be a simpleObjectinstance or an array (which is a type ofObject). The particular setter method used determines whether an element in this array is anObjector 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, andsetLongfall into this category. After these methods have been called, a call to the methodgetParamswill return an array with the values that have been set. Each element in the array is anObjectinstance 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 theRowSetobject'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
getParamsis 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 methodsetNullis 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 isnull, and the second element is theintsupplied for sqlType, which indicates the type of SQL value that is being set tonull. 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 tonullis 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 bygetParams. So, for example, if the parameter supplied tosetNullis2, the second element in the array returned bygetParamswill be an array of two or three elements.Some methods, such as
setObjectandsetDatehave versions that take more than two parameters, with the extra parameters giving information to the driver or the DBMS. For example, the methodssetDate,setTime, andsetTimestampcan take aCalendarobject as their third parameter. If the DBMS does not store time zone information, the driver uses theCalendarobject to construct theDate,Time, orTimestampobject being set. As is true with other methods that provide additional information, the element in the array returned bygetParamsis an array instead of a simpleObjectinstance.The methods
setAsciiStream,setBinaryStream,setCharacterStream, andsetUnicodeStream(which is deprecated, so applications should usegetCharacterStreaminstead) take three parameters, so for them, the element in the array returned bygetParamsis 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 theBaseRowSetconstants indicating the type of stream being set.NOTE: The method
getParamsis called internally byRowSetimplementations extending this class; it is not normally called by an application programmer directly.5.0 Event Notification
TheBaseRowSetclass 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
RowSetListenerinterface. If it has been added to aRowSetobject's list of listeners, it will be notified when an event occurs on thatRowSetobject. Each listener's implementation of theRowSetListenermethods defines what that object will do when it is notified that an event has occurred.There are three possible events for a
RowSetobject:- the cursor moves
- an individual row is changed (updated, deleted, or inserted)
- the contents of the entire
RowSetobject are changed
The
BaseRowSetmethod used for the notification indicates the type of event that has occurred. For example, the methodnotifyRowChangedindicates that a row has been updated, deleted, or inserted. Each of the notification methods creates aRowSetEventobject, which is supplied to the listener in order to identify theRowSetobject 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 defaultBaseRowSetobject is initialized with many starting values. The following is true of a defaultRowSetinstance that extends theBaseRowSetclass:- 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
RowSetobject'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
Vectorobject for storing the values set for the placeholder parameters in theRowSetobject'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
CachedRowSetobject crs to 500.crs.setMaxRows(500);Methods implemented in extensions of thisBaseRowSetclass must throw anSQLExceptionobject for any violation of the defined assertions. Also, if the extending class overrides and reimplements anyBaseRowSetmethod and encounters connectivity or underlying data source issues, that method may in addition throw anSQLExceptionobject for that reason.- Since:
- 1.5
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intASCII_STREAM_PARAMA constant indicating to aRowSetReaderImplobject that a given parameter is an ASCII stream.protected InputStreamasciiStreamTheInputStreamobject that will be returned by the methodgetAsciiStream, which is specified in theResultSetinterface.static intBINARY_STREAM_PARAMA constant indicating to aRowSetReaderImplobject that a given parameter is a binary stream.protected InputStreambinaryStreamTheInputStreamobject that will be returned by the methodgetBinaryStream, which is specified in theResultSetinterface.protected ReadercharStreamTheReaderobject that will be returned by the methodgetCharacterStream, which is specified in theResultSetinterface.static intUNICODE_STREAM_PARAMA constant indicating to aRowSetReaderImplobject that a given parameter is a Unicode stream.protected InputStreamunicodeStreamTheInputStreamobject that will be returned by the methodgetUnicodeStream, which is specified in theResultSetinterface.
-
Constructor Summary
Constructors Constructor Description BaseRowSet()Constructs a newBaseRowSetobject initialized with a defaultVectorobject for itslistenersfield.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddRowSetListener(RowSetListener listener)The listener will be notified whenever an event occurs on thisRowSetobject.voidclearParameters()Clears all of the current parameter values in thisRowSetobject's internal representation of the parameters to be set in thisRowSetobject's command when it is executed.StringgetCommand()Retrieves the SQL query that is the command for thisRowSetobject.intgetConcurrency()Returns the concurrency for thisRowSetobject.StringgetDataSourceName()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.DataSourceobject.booleangetEscapeProcessing()Ascertains whether escape processing is enabled for thisRowSetobject.intgetFetchDirection()Retrieves thisRowSetobject's current setting for the fetch direction.intgetFetchSize()Returns the fetch size for thisRowSetobject.intgetMaxFieldSize()Retrieves the maximum number of bytes that can be used for a column value in thisRowSetobject.intgetMaxRows()Retrieves the maximum number of rows that thisRowSetobject may contain.Object[]getParams()Retrieves an array containing the parameter values (both Objects and primitives) that have been set for thisRowSetobject's command and throws anSQLExceptionobject if all parameters have not been set.StringgetPassword()Returns the password used to create a database connection for thisRowSetobject.intgetQueryTimeout()Retrieves the maximum number of seconds the driver will wait for a query to execute.booleangetShowDeleted()Retrieves abooleanindicating whether rows marked for deletion appear in the set of current rows.intgetTransactionIsolation()Returns the transaction isolation property for thisRowSetobject's connection.intgetType()Returns the type of thisRowSetobject.Map<String,Class<?>>getTypeMap()Retrieves the type map associated with theConnectionobject for thisRowSetobject.StringgetUrl()Retrieves the JDBC URL that thisRowSetobject'sjavax.sql.Readerobject uses to make a connection with a relational database using a JDBC technology-enabled driver.StringgetUsername()Returns the user name used to create a database connection.protected voidinitParams()Performs the necessary internal configurations and initializations to allow any JDBCRowSetimplementation to start using the standard facilities provided by aBaseRowSetinstance.booleanisReadOnly()Returns abooleanindicating whether thisRowSetobject is read-only.protected voidnotifyCursorMoved()Notifies all of the listeners registered with thisRowSetobject that its cursor has moved.protected voidnotifyRowChanged()Notifies all of the listeners registered with thisRowSetobject that one of its rows has changed.protected voidnotifyRowSetChanged()Notifies all of the listeners registered with thisRowSetobject that its entire contents have changed.voidremoveRowSetListener(RowSetListener listener)Removes the designated object from thisRowSetobject's list of listeners.voidsetArray(int parameterIndex, Array array)Sets the designated parameter to anArrayobject in the Java programming language.voidsetAsciiStream(int parameterIndex, InputStream x)Sets the designated parameter in thisRowSetobject's command to the given input stream.voidsetAsciiStream(int parameterIndex, InputStream x, int length)Sets the designated parameter to the givenjava.io.InputStreamobject, which will have the specified number of bytes.voidsetAsciiStream(String parameterName, InputStream x)Sets the designated parameter to the given input stream.voidsetAsciiStream(String parameterName, InputStream x, int length)Sets the designated parameter to the given input stream, which will have the specified number of bytes.voidsetBigDecimal(int parameterIndex, BigDecimal x)Sets the designated parameter to the givenjava.lang.BigDecimalvalue.voidsetBigDecimal(String parameterName, BigDecimal x)Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidsetBinaryStream(int parameterIndex, InputStream x)Sets the designated parameter in thisRowSetobject's command to the given input stream.voidsetBinaryStream(int parameterIndex, InputStream x, int length)Sets the designated parameter to the givenjava.io.InputStreamobject, which will have the specified number of bytes.voidsetBinaryStream(String parameterName, InputStream x)Sets the designated parameter to the given input stream.voidsetBinaryStream(String parameterName, InputStream x, int length)Sets the designated parameter to the given input stream, which will have the specified number of bytes.voidsetBlob(int parameterIndex, InputStream inputStream)Sets the designated parameter to aInputStreamobject.voidsetBlob(int parameterIndex, InputStream inputStream, long length)Sets the designated parameter to aInputStreamobject.voidsetBlob(int parameterIndex, Blob x)Sets the designated parameter to the givenBlobobject in the Java programming language.voidsetBlob(String parameterName, InputStream inputStream)Sets the designated parameter to aInputStreamobject.voidsetBlob(String parameterName, InputStream inputStream, long length)Sets the designated parameter to aInputStreamobject.voidsetBlob(String parameterName, Blob x)Sets the designated parameter to the givenjava.sql.Blobobject.voidsetBoolean(int parameterIndex, boolean x)Sets the designated parameter to the givenbooleanin the Java programming language.voidsetBoolean(String parameterName, boolean x)Sets the designated parameter to the given Javabooleanvalue.voidsetByte(int parameterIndex, byte x)Sets the designated parameter to the givenbytein the Java programming language.voidsetByte(String parameterName, byte x)Sets the designated parameter to the given Javabytevalue.voidsetBytes(int parameterIndex, byte[] x)Sets the designated parameter to the given array of bytes.voidsetBytes(String parameterName, byte[] x)Sets the designated parameter to the given Java array of bytes.voidsetCharacterStream(int parameterIndex, Reader reader)Sets the designated parameter in thisRowSetobject's command to the givenReaderobject.voidsetCharacterStream(int parameterIndex, Reader reader, int length)Sets the designated parameter to the givenjava.io.Readerobject, which will have the specified number of characters.voidsetCharacterStream(String parameterName, Reader reader)Sets the designated parameter to the givenReaderobject.voidsetCharacterStream(String parameterName, Reader reader, int length)Sets the designated parameter to the givenReaderobject, which is the given number of characters long.voidsetClob(int parameterIndex, Reader reader)Sets the designated parameter to aReaderobject.voidsetClob(int parameterIndex, Reader reader, long length)Sets the designated parameter to aReaderobject.voidsetClob(int parameterIndex, Clob x)Sets the designated parameter to the givenClobobject in the Java programming language.voidsetClob(String parameterName, Reader reader)Sets the designated parameter to aReaderobject.voidsetClob(String parameterName, Reader reader, long length)Sets the designated parameter to aReaderobject.voidsetClob(String parameterName, Clob x)Sets the designated parameter to the givenjava.sql.Clobobject.voidsetCommand(String cmd)Sets thisRowSetobject'scommandproperty to the givenStringobject and clears the parameters, if any, that were set for the previous command.voidsetConcurrency(int concurrency)Sets the concurrency for thisRowSetobject to the specified concurrency.voidsetDataSourceName(String name)Sets theDataSourcename property for thisRowSetobject to the given logical name and sets thisRowSetobject's Url property tonull.voidsetDate(int parameterIndex, Date x)Sets the designated parameter to the givenjava.sql.Datevalue.voidsetDate(int parameterIndex, Date x, Calendar cal)Sets the designated parameter to the givenjava.sql.Dateobject.voidsetDate(String parameterName, Date x)Sets the designated parameter to the givenjava.sql.Datevalue using the default time zone of the virtual machine that is running the application.voidsetDate(String parameterName, Date x, Calendar cal)Sets the designated parameter to the givenjava.sql.Datevalue, using the givenCalendarobject.voidsetDouble(int parameterIndex, double x)Sets the designated parameter to the givendoublein the Java programming language.voidsetDouble(String parameterName, double x)Sets the designated parameter to the given Javadoublevalue.voidsetEscapeProcessing(boolean enable)Sets to the givenbooleanwhether or not the driver will scan for escape syntax and do escape substitution before sending SQL statements to the database.voidsetFetchDirection(int direction)Gives the driver a performance hint as to the direction in which the rows in thisRowSetobject will be processed.voidsetFetchSize(int rows)Sets the fetch size for thisRowSetobject to the given number of rows.voidsetFloat(int parameterIndex, float x)Sets the designated parameter to the givenfloatin the Java programming language.voidsetFloat(String parameterName, float x)Sets the designated parameter to the given Javafloatvalue.voidsetInt(int parameterIndex, int x)Sets the designated parameter to anintin the Java programming language.voidsetInt(String parameterName, int x)Sets the designated parameter to the given Javaintvalue.voidsetLong(int parameterIndex, long x)Sets the designated parameter to the givenlongin the Java programming language.voidsetLong(String parameterName, long x)Sets the designated parameter to the given Javalongvalue.voidsetMaxFieldSize(int max)Sets the maximum number of bytes that can be used for a column value in thisRowSetobject to the given number.voidsetMaxRows(int max)Sets the maximum number of rows that thisRowSetobject may contain to the given number.voidsetNCharacterStream(int parameterIndex, Reader value)Sets the designated parameter in thisRowSetobject's command to aReaderobject.voidsetNCharacterStream(int parameterIndex, Reader value, long length)Sets the designated parameter to aReaderobject.voidsetNCharacterStream(String parameterName, Reader value)Sets the designated parameter to aReaderobject.voidsetNCharacterStream(String parameterName, Reader value, long length)Sets the designated parameter to aReaderobject.voidsetNClob(int parameterIndex, Reader reader)Sets the designated parameter to aReaderobject.voidsetNClob(int parameterIndex, Reader reader, long length)Sets the designated parameter to aReaderobject.voidsetNClob(int parameterIndex, NClob value)Sets the designated parameter to ajava.sql.NClobobject.voidsetNClob(String parameterName, Reader reader)Sets the designated parameter to aReaderobject.voidsetNClob(String parameterName, Reader reader, long length)Sets the designated parameter to aReaderobject.voidsetNClob(String parameterName, NClob value)Sets the designated parameter to ajava.sql.NClobobject.voidsetNString(int parameterIndex, String value)Sets the designated parameter to the givenStringobject.voidsetNString(String parameterName, String value)Sets the designated parameter to the givenStringobject.voidsetNull(int parameterIndex, int sqlType)Sets the designated parameter to SQLNULL.voidsetNull(int parameterIndex, int sqlType, String typeName)Sets the designated parameter to SQLNULL.voidsetNull(String parameterName, int sqlType)Sets the designated parameter to SQLNULL.voidsetNull(String parameterName, int sqlType, String typeName)Sets the designated parameter to SQLNULL.voidsetObject(int parameterIndex, Object x)Sets the designated parameter to anObjectin the Java programming language.voidsetObject(int parameterIndex, Object x, int targetSqlType)Sets the value of the designated parameter with the givenObjectvalue.voidsetObject(int parameterIndex, Object x, int targetSqlType, int scale)Sets the designated parameter to anObjectin the Java programming language.voidsetObject(String parameterName, Object x)Sets the value of the designated parameter with the given object.voidsetObject(String parameterName, Object x, int targetSqlType)Sets the value of the designated parameter with the given object.voidsetObject(String parameterName, Object x, int targetSqlType, int scale)Sets the value of the designated parameter with the given object.voidsetPassword(String pass)Sets the password used to create a database connection for thisRowSetobject to the givenStringobject.voidsetQueryTimeout(int seconds)Sets to the given number the maximum number of seconds the driver will wait for a query to execute.voidsetReadOnly(boolean value)Sets thisRowSetobject's readOnly property to the givenboolean.voidsetRef(int parameterIndex, Ref ref)Sets the designated parameter to the givenRefobject in the Java programming language.voidsetRowId(int parameterIndex, RowId x)Sets the designated parameter to the givenjava.sql.RowIdobject.voidsetRowId(String parameterName, RowId x)Sets the designated parameter to the givenjava.sql.RowIdobject.voidsetShort(int parameterIndex, short x)Sets the designated parameter to the givenshortin the Java programming language.voidsetShort(String parameterName, short x)Sets the designated parameter to the given Javashortvalue.voidsetShowDeleted(boolean value)Sets the propertyshowDeletedto the givenbooleanvalue, which determines whether rows marked for deletion appear in the set of current rows.voidsetSQLXML(int parameterIndex, SQLXML xmlObject)Sets the designated parameter to the givenjava.sql.SQLXMLobject.voidsetSQLXML(String parameterName, SQLXML xmlObject)Sets the designated parameter to the givenjava.sql.SQLXMLobject.voidsetString(int parameterIndex, String x)Sets the designated parameter to the givenStringvalue.voidsetString(String parameterName, String x)Sets the designated parameter to the given JavaStringvalue.voidsetTime(int parameterIndex, Time x)Sets the designated parameter to the givenjava.sql.Timevalue.voidsetTime(int parameterIndex, Time x, Calendar cal)Sets the designated parameter to the givenjava.sql.Timeobject.voidsetTime(String parameterName, Time x)Sets the designated parameter to the givenjava.sql.Timevalue.voidsetTime(String parameterName, Time x, Calendar cal)Sets the designated parameter to the givenjava.sql.Timevalue, using the givenCalendarobject.voidsetTimestamp(int parameterIndex, Timestamp x)Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetTimestamp(int parameterIndex, Timestamp x, Calendar cal)Sets the designated parameter to the givenjava.sql.Timestampobject.voidsetTimestamp(String parameterName, Timestamp x)Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetTimestamp(String parameterName, Timestamp x, Calendar cal)Sets the designated parameter to the givenjava.sql.Timestampvalue, using the givenCalendarobject.voidsetTransactionIsolation(int level)Sets the transaction isolation property for this JDBCRowSetobject to the given constant.voidsetType(int type)Sets the type for thisRowSetobject to the specified type.voidsetTypeMap(Map<String,Class<?>> map)Installs the givenjava.util.Mapobject as the type map associated with theConnectionobject for thisRowSetobject.voidsetUnicodeStream(int parameterIndex, InputStream x, int length)Deprecated.getCharacterStream should be used in its placevoidsetUrl(String url)Sets the Url property for thisRowSetobject to the givenStringobject and sets the dataSource name property tonull.voidsetURL(int parameterIndex, URL x)Sets the designated parameter to the givenjava.net.URLvalue.voidsetUsername(String name)Sets the username property for thisRowSetobject to the given user name.
-
-
-
Field Detail
-
UNICODE_STREAM_PARAM
public static final int UNICODE_STREAM_PARAM
A constant indicating to aRowSetReaderImplobject that a given parameter is a Unicode stream. ThisRowSetReaderImplobject is provided as an extension of theSyncProviderabstract class defined in theSyncFactorystatic factory SPI mechanism.- See Also:
- Constant Field Values
-
BINARY_STREAM_PARAM
public static final int BINARY_STREAM_PARAM
A constant indicating to aRowSetReaderImplobject that a given parameter is a binary stream. ARowSetReaderImplobject is provided as an extension of theSyncProviderabstract class defined in theSyncFactorystatic factory SPI mechanism.- See Also:
- Constant Field Values
-
ASCII_STREAM_PARAM
public static final int ASCII_STREAM_PARAM
A constant indicating to aRowSetReaderImplobject that a given parameter is an ASCII stream. ARowSetReaderImplobject is provided as an extension of theSyncProviderabstract class defined in theSyncFactorystatic factory SPI mechanism.- See Also:
- Constant Field Values
-
binaryStream
protected InputStream binaryStream
TheInputStreamobject that will be returned by the methodgetBinaryStream, which is specified in theResultSetinterface.
-
unicodeStream
protected InputStream unicodeStream
TheInputStreamobject that will be returned by the methodgetUnicodeStream, which is specified in theResultSetinterface.
-
asciiStream
protected InputStream asciiStream
TheInputStreamobject that will be returned by the methodgetAsciiStream, which is specified in theResultSetinterface.
-
charStream
protected Reader charStream
TheReaderobject that will be returned by the methodgetCharacterStream, which is specified in theResultSetinterface.
-
-
Method Detail
-
initParams
protected void initParams()
Performs the necessary internal configurations and initializations to allow any JDBCRowSetimplementation to start using the standard facilities provided by aBaseRowSetinstance. This method should be called after theRowSetobject has been instantiated to correctly initialize all parameters. This method should never be called by an application, but is called from with aRowSetimplementation extending this class.
-
addRowSetListener
public void addRowSetListener(RowSetListener listener)
The listener will be notified whenever an event occurs on thisRowSetobject.A listener might, for example, be a table or graph that needs to be updated in order to accurately reflect the current state of the
RowSetobject.Note: if the
RowSetListenerobject isnull, this method silently discards thenullvalue and does not add a null reference to the set of listeners.Note: if the listener is already set, and the new
RowSetListenerinstance is added to the set of listeners already registered to receive event notifications from thisRowSet.- Parameters:
listener- an object that has implemented thejavax.sql.RowSetListenerinterface and wants to be notified of any events that occur on thisRowSetobject; May be null.- See Also:
removeRowSetListener(javax.sql.RowSetListener)
-
removeRowSetListener
public void removeRowSetListener(RowSetListener listener)
Removes the designated object from thisRowSetobject's list of listeners. If the given argument is not a registered listener, this method does nothing. Note: if theRowSetListenerobject isnull, this method silently discards thenullvalue.- Parameters:
listener- aRowSetListenerobject that is on the list of listeners for thisRowSetobject- See Also:
addRowSetListener(javax.sql.RowSetListener)
-
notifyCursorMoved
protected void notifyCursorMoved() throws SQLExceptionNotifies all of the listeners registered with thisRowSetobject 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- if the class extending theBaseRowSetabstract class does not implement theRowSetinterface or one of it's sub-interfaces.
-
notifyRowChanged
protected void notifyRowChanged() throws SQLExceptionNotifies all of the listeners registered with thisRowSetobject that one of its rows has changed.When an application calls a method that changes a row, such as the
CachedRowSetmethodsinsertRow,updateRow, ordeleteRow, that method callsnotifyRowChangedinternally. An application should never invoke this method directly.- Throws:
SQLException- if the class extending theBaseRowSetabstract class does not implement theRowSetinterface or one of it's sub-interfaces.
-
notifyRowSetChanged
protected void notifyRowSetChanged() throws SQLExceptionNotifies all of the listeners registered with thisRowSetobject that its entire contents have changed.When an application calls methods that change the entire contents of the
RowSetobject, such as theCachedRowSetmethodsexecute,populate,restoreOriginal, orrelease, that method callsnotifyRowSetChangedinternally (either directly or indirectly). An application should never invoke this method directly.- Throws:
SQLException- if the class extending theBaseRowSetabstract class does not implement theRowSetinterface or one of it's sub-interfaces.
-
getCommand
public String getCommand()
Retrieves the SQL query that is the command for thisRowSetobject. The command property contains the query that will be executed to populate thisRowSetobject.The SQL query returned by this method is used by
RowSetmethods such asexecuteandpopulate, which may be implemented by any class that extends theBaseRowSetabstract class and implements one or more of the standard JSR-114RowSetinterfaces.The command is used by the
RowSetobject's reader to obtain aResultSetobject. The reader then reads the data from theResultSetobject and uses it to to populate thisRowSetobject.The default value for the
commandproperty isnull.- Returns:
- the
Stringthat is the value for thisRowSetobject'scommandproperty; may benull - See Also:
setCommand(java.lang.String)
-
setCommand
public void setCommand(String cmd) throws SQLException
Sets thisRowSetobject'scommandproperty to the givenStringobject and clears the parameters, if any, that were set for the previous command.The
commandproperty may not be needed if theRowSetobject 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- aStringobject containing an SQL query that will be set as thisRowSetobject's command property; may benullbut may not be an empty string- Throws:
SQLException- if an empty string is provided as the command value- See Also:
getCommand()
-
getUrl
public String getUrl() throws SQLException
Retrieves the JDBC URL that thisRowSetobject'sjavax.sql.Readerobject uses to make a connection with a relational database using a JDBC technology-enabled driver.The
Urlproperty will benullif the underlying data source is a non-SQL data source, such as a spreadsheet or an XML data source.- Returns:
- a
Stringobject that contains the JDBC URL used to establish the connection for thisRowSetobject; may benull(default value) if not set - Throws:
SQLException- if an error occurs retrieving the URL value- See Also:
setUrl(java.lang.String)
-
setUrl
public void setUrl(String url) throws SQLException
Sets the Url property for thisRowSetobject to the givenStringobject 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 anyStringobject except one with a length of0(an empty string).Setting the Url property is optional if connections are established using a
DataSourceobject 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 theRowSetobject to connect to a database. TheRowSetobject will use the URL internally to create a database connection in order to read or write data.- Parameters:
url- aStringobject that contains the JDBC URL that will be used to establish the connection to a database for thisRowSetobject; may benullbut must not be an empty string- Throws:
SQLException- 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.DataSourceobject. ThisDataSourceobject 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:
- a
Stringobject that identifies theDataSourceobject to be used for making a connection; if no logical name has been set,nullis returned. - See Also:
setDataSourceName(java.lang.String)
-
setDataSourceName
public void setDataSourceName(String name) throws SQLException
Sets theDataSourcename property for thisRowSetobject to the given logical name and sets thisRowSetobject's Url property tonull. The name must have been bound to aDataSourceobject in a JNDI naming service so that an application can do a lookup using that name to retrieve theDataSourceobject bound to it. TheDataSourceobject 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- aStringobject with the name that can be supplied to a naming service based on JNDI technology to retrieve theDataSourceobject that can be used to get a connection; may benullbut must not be an empty string- Throws:
SQLException- if an empty string is provided as theDataSourcename- 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:
- the
Stringobject 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 thisRowSetobject to the given user name. Because it is not serialized, the username property is set at run time before calling the methodexecute.- Parameters:
name- theStringobject 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 thisRowSetobject. Because the password property is not serialized, it is set at run time before calling the methodexecute. The default value isnull- Returns:
- the
Stringobject 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 thisRowSetobject to the givenStringobject. Because the password property is not serialized, it is set at run time before calling the methodexecute.- Parameters:
pass- theStringobject 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 SQLExceptionSets the type for thisRowSetobject 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- if the parameter supplied is not one of the following constants:ResultSet.TYPE_FORWARD_ONLYorResultSet.TYPE_SCROLL_INSENSITIVEResultSet.TYPE_SCROLL_SENSITIVE- See Also:
getConcurrency(),getType()
-
getType
public int getType() throws SQLExceptionReturns the type of thisRowSetobject. The type is initially determined by the statement that created theRowSetobject. TheRowSetobject can call the methodsetTypeat any time to change its type. The default isTYPE_SCROLL_INSENSITIVE.- Returns:
- the type of this JDBC
RowSetobject, which must be one of the following:ResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE, orResultSet.TYPE_SCROLL_SENSITIVE - Throws:
SQLException- if an error occurs getting the type of of thisRowSetobject- See Also:
setType(int)
-
setConcurrency
public void setConcurrency(int concurrency) throws SQLExceptionSets the concurrency for thisRowSetobject to the specified concurrency. The default concurrency for anyRowSetobject (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_ONLYorResultSet.CONCUR_UPDATABLE- Throws:
SQLException- if the parameter supplied is not one of the following constants:ResultSet.CONCUR_UPDATABLEorResultSet.CONCUR_READ_ONLY- See Also:
getConcurrency(),isReadOnly()
-
isReadOnly
public boolean isReadOnly()
Returns abooleanindicating whether thisRowSetobject is read-only. Any attempts to update a read-onlyRowSetobject will result in anSQLExceptionbeing thrown. By default, rowsets are updatable if updates are possible.- Returns:
trueif thisRowSetobject cannot be updated;falseotherwise- See Also:
setConcurrency(int),setReadOnly(boolean)
-
setReadOnly
public void setReadOnly(boolean value)
Sets thisRowSetobject's readOnly property to the givenboolean.- Parameters:
value-trueto indicate that thisRowSetobject is read-only;falseto indicate that it is updatable
-
getTransactionIsolation
public int getTransactionIsolation()
Returns the transaction isolation property for thisRowSetobject's connection. This property represents the transaction isolation level requested for use in transactions.For
RowSetimplementations such as theCachedRowSetthat operate in a disconnected environment, theSyncProviderobject offers complementary locking and data integrity options. The options described below are pertinent only to connectedRowSetobjects (JdbcRowSetobjects).- 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 SQLExceptionSets the transaction isolation property for this JDBCRowSetobject to the given constant. The DBMS will use this transaction isolation level for transactions if it can.For
RowSetimplementations such as theCachedRowSetthat operate in a disconnected environment, theSyncProviderobject being used offers complementary locking and data integrity options. The options described below are pertinent only to connectedRowSetobjects (JdbcRowSetobjects).- 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- if the given parameter is not one of the Connection constants- See Also:
SyncFactory,SyncProvider,getTransactionIsolation()
-
getTypeMap
public Map<String,Class<?>> getTypeMap()
Retrieves the type map associated with theConnectionobject for thisRowSetobject.Drivers that support the JDBC 3.0 API will create
Connectionobjects with an associated type map. This type map, which is initially empty, can contain one or more fully-qualified SQL names andClassobjects 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:
- the
java.util.Mapobject that is the type map for thisRowSetobject's connection
-
setTypeMap
public void setTypeMap(Map<String,Class<?>> map)
Installs the givenjava.util.Mapobject as the type map associated with theConnectionobject for thisRowSetobject. 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.Mapobject that contains the mapping from SQL type names for user defined types (UDT) to classes in the Java programming language. Each entry in theMapobject consists of the fully qualified SQL name of a UDT and theClassobject for theSQLDataimplementation of that UDT. May benull.
-
getMaxFieldSize
public int getMaxFieldSize() throws SQLExceptionRetrieves the maximum number of bytes that can be used for a column value in thisRowSetobject. 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:
- an
intindicating the current maximum column size limit; zero means that there is no limit - Throws:
SQLException- if an error occurs internally determining the maximum limit of the column size
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws SQLExceptionSets the maximum number of bytes that can be used for a column value in thisRowSetobject 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- anintindicating the new maximum column size limit; zero means that there is no limit- Throws:
SQLException- if (1) an error occurs internally setting the maximum limit of the column size or (2) a size of less than 0 is set
-
getMaxRows
public int getMaxRows() throws SQLExceptionRetrieves the maximum number of rows that thisRowSetobject may contain. If this limit is exceeded, the excess rows are silently dropped.- Returns:
- an
intindicating the current maximum number of rows; zero means that there is no limit - Throws:
SQLException- if an error occurs internally determining the maximum limit of rows that aRowsetobject can contain
-
setMaxRows
public void setMaxRows(int max) throws SQLExceptionSets the maximum number of rows that thisRowSetobject may contain to the given number. If this limit is exceeded, the excess rows are silently dropped.- Parameters:
max- anintindicating the current maximum number of rows; zero means that there is no limit- Throws:
SQLException- if an error occurs internally setting the maximum limit on the number of rows that a JDBCRowSetobject can contain; or if max is less than0; or if max is less than thefetchSizeof theRowSet
-
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws SQLExceptionSets to the givenbooleanwhether 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: Since
PreparedStatementobjects have usually been parsed prior to making this call, disabling escape processing for prepared statements will likely have no effect.- Parameters:
enable-trueto enable escape processing;falseto disable it- Throws:
SQLException- if an error occurs setting the underlying JDBC technology-enabled driver to process the escape syntax
-
getQueryTimeout
public int getQueryTimeout() throws SQLExceptionRetrieves the maximum number of seconds the driver will wait for a query to execute. If the limit is exceeded, anSQLExceptionis thrown.- Returns:
- the current query timeout limit in seconds; zero means that there is no limit
- Throws:
SQLException- if an error occurs in determining the query time-out value
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws SQLExceptionSets to the given number the maximum number of seconds the driver will wait for a query to execute. If the limit is exceeded, anSQLExceptionis 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- if an error occurs setting the query time-out or if the query time-out value is less than 0
-
getShowDeleted
public boolean getShowDeleted() throws SQLExceptionRetrieves abooleanindicating 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, most
RowSetobject users can simply ignore this extra detail because only sophisticated applications will likely want to take advantage of this feature.- Returns:
trueif deleted rows are visible;falseotherwise- Throws:
SQLException- if an error occurs determining if deleted rows are visible or not- See Also:
setShowDeleted(boolean)
-
setShowDeleted
public void setShowDeleted(boolean value) throws SQLExceptionSets the propertyshowDeletedto the givenbooleanvalue, which determines whether rows marked for deletion appear in the set of current rows.- Parameters:
value-trueif deleted rows should be shown;falseotherwise- Throws:
SQLException- if an error occurs setting whether deleted rows are visible or not- See Also:
getShowDeleted()
-
getEscapeProcessing
public boolean getEscapeProcessing() throws SQLExceptionAscertains whether escape processing is enabled for thisRowSetobject.- Returns:
trueif escape processing is turned on;falseotherwise- Throws:
SQLException- if an error occurs determining if escape processing is enabled or not or if the internal escape processing trigger has not been enabled
-
setFetchDirection
public void setFetchDirection(int direction) throws SQLExceptionGives the driver a performance hint as to the direction in which the rows in thisRowSetobject will be processed. The driver may ignore this hint.A
RowSetobject inherits the default properties of theResultSetobject from which it got its data. ThatResultSetobject's default fetch direction is set by theStatementobject that created it.This method applies to a
RowSetobject only while it is connected to a database using a JDBC driver.A
RowSetobject 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- if (1) theRowSettype isTYPE_FORWARD_ONLYand the given fetch direction is notFETCH_FORWARDor (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 SQLExceptionRetrieves thisRowSetobject's current setting for the fetch direction. The default type isResultSet.FETCH_FORWARD- Returns:
- one of
ResultSet.FETCH_FORWARD,ResultSet.FETCH_REVERSE, orResultSet.FETCH_UNKNOWN - Throws:
SQLException- if an error occurs in determining the current fetch direction for fetching rows- See Also:
setFetchDirection(int)
-
setFetchSize
public void setFetchSize(int rows) throws SQLExceptionSets the fetch size for thisRowSetobject 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 thisRowSetobject. 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.A
RowSetobject inherits the default properties of theResultSetobject from which it got its data. ThatResultSetobject's default fetch size is set by theStatementobject that created it.This method applies to a
RowSetobject only while it is connected to a database using a JDBC driver. For connectedRowSetimplementations such asJdbcRowSet, this method has a direct and immediate effect on the underlying JDBC driver.A
RowSetobject may use this method at any time to change its setting for the fetch size.For
RowSetimplementations such asCachedRowSet, which operate in a disconnected environment, theSyncProviderobject 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 specificSyncProviderobject employed by the disconnectedRowSetobject.- Parameters:
rows- the number of rows to fetch;0to let the driver decide what the best fetch size is; must not be less than0or more than the maximum number of rows allowed for thisRowSetobject (the number returned by a call to the methodgetMaxRows())- Throws:
SQLException- if the specified fetch size is less than0or more than the limit for the maximum number of rows- See Also:
getFetchSize()
-
getFetchSize
public int getFetchSize() throws SQLExceptionReturns the fetch size for thisRowSetobject. The default value is zero.- Returns:
- the number of rows suggested as the fetch size when this
RowSetobject needs more rows from the database - Throws:
SQLException- if an error occurs determining the number of rows in the current fetch size- See Also:
setFetchSize(int)
-
getConcurrency
public int getConcurrency() throws SQLExceptionReturns the concurrency for thisRowSetobject. The default isCONCUR_UPDATABLEfor both connected and disconnectedRowSetobjects.An application can call the method
setConcurrencyat any time to change aRowSetobject's concurrency.- Returns:
- the concurrency type for this
RowSetobject, which must be one of the following:ResultSet.CONCUR_READ_ONLYorResultSet.CONCUR_UPDATABLE - Throws:
SQLException- if an error occurs getting the concurrency of thisRowSetobject- See Also:
setConcurrency(int),isReadOnly()
-
setNull
public void setNull(int parameterIndex, int sqlType) throws SQLExceptionSets 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 to
NULL. 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsafter this version ofsetNullhas been called will return anObjectarray 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greatersqlType- anintthat is one of the SQL type codes defined in the classTypes. If a non-standard sqlType is supplied, this method will not throw aSQLException. This allows implicit support for non-standard SQL types.- Throws:
SQLException- 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 SQLExceptionSets the designated parameter to SQLNULL. Although this version of the methodsetNullis intended for user-defined andREFparameters, 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 a
NULLuser-defined orREFparameter. In the case of a user-defined type, the name is the type name of the parameter itself. For aREFparameter, 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 or
REFtype, the giventypeNameparameter is ignored.The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsafter this version ofsetNullhas been called will return anObjectarray 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greatersqlType- a value fromjava.sql.TypestypeName- the fully qualified name of an SQL user-defined type, which is ignored if the parameter is not a user-defined type orREFvalue- Throws:
SQLException- 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 SQLExceptionSets the designated parameter to the givenbooleanin the Java programming language. The driver converts this to an SQLBITvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecute,populatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.- Parameters:
parameterIndex- the ordinal number of the placeholder parameter in thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setByte
public void setByte(int parameterIndex, byte x) throws SQLExceptionSets the designated parameter to the givenbytein the Java programming language. The driver converts this to an SQLTINYINTvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.- Parameters:
parameterIndex- the ordinal number of the placeholder parameter in thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setShort
public void setShort(int parameterIndex, short x) throws SQLExceptionSets the designated parameter to the givenshortin the Java programming language. The driver converts this to an SQLSMALLINTvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.- Parameters:
parameterIndex- the ordinal number of the placeholder parameter in thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setInt
public void setInt(int parameterIndex, int x) throws SQLExceptionSets the designated parameter to anintin the Java programming language. The driver converts this to an SQLINTEGERvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.- Parameters:
parameterIndex- the ordinal number of the placeholder parameter in thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setLong
public void setLong(int parameterIndex, long x) throws SQLExceptionSets the designated parameter to the givenlongin the Java programming language. The driver converts this to an SQLBIGINTvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.- Parameters:
parameterIndex- the ordinal number of the placeholder parameter in thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setFloat
public void setFloat(int parameterIndex, float x) throws SQLExceptionSets the designated parameter to the givenfloatin the Java programming language. The driver converts this to an SQLFLOATvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.- Parameters:
parameterIndex- the ordinal number of the placeholder parameter in thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setDouble
public void setDouble(int parameterIndex, double x) throws SQLExceptionSets the designated parameter to the givendoublein the Java programming language. The driver converts this to an SQLDOUBLEvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.- Parameters:
parameterIndex- the ordinal number of the placeholder parameter in thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setBigDecimal
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLExceptionSets the designated parameter to the givenjava.lang.BigDecimalvalue. The driver converts this to an SQLNUMERICvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.Note:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.- Parameters:
parameterIndex- the ordinal number of the placeholder parameter in thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setString
public void setString(int parameterIndex, String x) throws SQLExceptionSets the designated parameter to the givenStringvalue. The driver converts this to an SQLVARCHARorLONGVARCHARvalue (depending on the argument's size relative to the driver's limits onVARCHARvalues) 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.- Parameters:
parameterIndex- the ordinal number of the placeholder parameter in thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setBytes
public void setBytes(int parameterIndex, byte[] x) throws SQLExceptionSets the designated parameter to the given array of bytes. The driver converts this to an SQLVARBINARYorLONGVARBINARYvalue (depending on the argument's size relative to the driver's limits onVARBINARYvalues) 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.- Parameters:
parameterIndex- the ordinal number of the placeholder parameter in thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setDate
public void setDate(int parameterIndex, Date x) throws SQLExceptionSets the designated parameter to the givenjava.sql.Datevalue. The driver converts this to an SQLDATEvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsafter this version ofsetDatehas been called will return an array with the value to be set for placeholder parameter number parameterIndex being theDateobject 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the parameter value- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setTime
public void setTime(int parameterIndex, Time x) throws SQLExceptionSets the designated parameter to the givenjava.sql.Timevalue. The driver converts this to an SQLTIMEvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsafter this version of the methodsetTimehas 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 theTimeobject 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- ajava.sql.Timeobject, which is to be set as the value for placeholder parameter parameterIndex- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setTimestamp
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLExceptionSets the designated parameter to the givenjava.sql.Timestampvalue. The driver converts this to an SQLTIMESTAMPvalue 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsafter this version ofsetTimestamphas been called will return an array with the value for parameter placeholder number parameterIndex being theTimestampobject 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- ajava.sql.Timestampobject- Throws:
SQLException- 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 SQLExceptionSets the designated parameter to the givenjava.io.InputStreamobject, which will have the specified number of bytes. The contents of the stream will be read and sent to the database. This method throws anSQLExceptionobject 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 a
LONGVARCHARparameter, it may be more practical to send it via ajava.io.InputStreamobject. 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 databaseCHARformat.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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.Note:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsaftersetAsciiStreamhas 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.InputStreamobject. The second element is the value set for length. The third element is an internalBaseRowSetconstant 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the Java input stream that contains the ASCII parameter valuelength- 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- 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
public void setAsciiStream(int parameterIndex, InputStream x) throws SQLExceptionSets the designated parameter in thisRowSetobject's command to the given input stream. When a very large ASCII value is input to aLONGVARCHARparameter, 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 of
setAsciiStreamwhich 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- if a database access error occurs or this method is called on a closedPreparedStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setBinaryStream
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLExceptionSets the designated parameter to the givenjava.io.InputStreamobject, which will have the specified number of bytes. The contents of the stream will be read and sent to the database. This method throws anSQLExceptionobject 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 a
LONGVARBINARYparameter, it may be more practical to send it via ajava.io.InputStreamobject. 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsaftersetBinaryStreamhas 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.InputStreamobject. The second element is the value set for length. The third element is an internalBaseRowSetconstant 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the input stream that contains the binary value to be setlength- 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- 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
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLExceptionSets the designated parameter in thisRowSetobject's command to the given input stream. When a very large binary value is input to aLONGVARBINARYparameter, it may be more practical to send it via ajava.io.InputStreamobject. 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 of
setBinaryStreamwhich 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- if a database access error occurs or this method is called on a closedPreparedStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setUnicodeStream
@Deprecated public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException
Deprecated.getCharacterStream should be used in its placeSets the designated parameter to the givenjava.io.InputStreamobject, which will have the specified number of bytes. The contents of the stream will be read and sent to the database. This method throws anSQLExceptionif the number of bytes read and sent to the database is not equal to length.When a very large Unicode value is input to a
LONGVARCHARparameter, it may be more practical to send it via ajava.io.InputStreamobject. 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 databaseCHARformat. 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 method
getCharacterStreamshould be used in its place.The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in this
RowSetobject's command when the methodexecuteis called. Calls made to the methodgetParamsaftersetUnicodeStreamhas 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.InputStreamobject. The second element is the value set for length. The third element is an internalBaseRowSetconstant 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- thejava.io.InputStreamobject that contains the UNICODE parameter valuelength- the number of bytes in the input stream- Throws:
SQLException- 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 SQLExceptionSets the designated parameter to the givenjava.io.Readerobject, which will have the specified number of characters. The contents of the reader will be read and sent to the database. This method throws anSQLExceptionif the number of bytes read and sent to the database is not equal to length.When a very large Unicode value is input to a
LONGVARCHARparameter, it may be more practical to send it via aReaderobject. 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 databaseCHARformat. 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsaftersetCharacterStreamhas 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.Readerobject. 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterreader- theReaderobject that contains the Unicode datalength- 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- 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 SQLExceptionSets the designated parameter in thisRowSetobject's command to the givenReaderobject. When a very large UNICODE value is input to aLONGVARCHARparameter, it may be more practical to send it via ajava.io.Readerobject. 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 of
setCharacterStreamwhich takes a length parameter.- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...reader- thejava.io.Readerobject that contains the Unicode data- Throws:
SQLException- if a database access error occurs or this method is called on a closedPreparedStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setObject
public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLExceptionSets the designated parameter to anObjectin the Java programming language. The second parameter must be anObjecttype. For integral values, thejava.langequivalent objects should be used. For example, use the classIntegerfor 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 implementing
SQLData), the driver should call the methodSQLData.writeSQLto 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsafter this version ofsetObjecthas 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 givenObjectinstance, 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.NUMERICorjava.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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- theObjectcontaining the input parameter value; must be anObjecttypetargetSqlType- the SQL type (as defined injava.sql.Types) to be sent to the database. Thescaleargument 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.DECIMALandjava.sql.Types.NUMERIC, this is the number of digits after the decimal point. For all other types, this value will be ignored.- Throws:
SQLException- 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 SQLExceptionSets the value of the designated parameter with the givenObjectvalue. 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsafter this version ofsetObjecthas 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 givenObjectinstance. 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- theObjectcontaining the input parameter value; must be anObjecttypetargetSqlType- 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- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setObject
public void setObject(int parameterIndex, Object x) throws SQLExceptionSets the designated parameter to anObjectin the Java programming language. The second parameter must be anObjecttype. For integral values, thejava.langequivalent objects should be used. For example, use the classIntegerfor anint.The JDBC specification defines a standard mapping from Java
Objecttypes 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.writeSQLto write the object to the SQL data stream.If, on the other hand, the object is of a class implementing
Ref,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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.After this method has been called, a call to the method
getParamswill return an object array of the current command parameters, which will include theObjectset 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- the object containing the input parameter value- Throws:
SQLException- 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 SQLExceptionSets the designated parameter to the givenRefobject in the Java programming language. The driver converts this to an SQLREFvalue when it sends it to the database. Internally, theRefis represented as aSerialRefto ensure serializability.The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.After this method has been called, a call to the method
getParamswill return an object array of the current command parameters, which will include theRefobject 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterref- aRefobject representing an SQLREFvalue; cannot be null- Throws:
SQLException- if an error occurs; the parameter index is out of bounds or theRefobject isnull; or theRefobject returns anullbase type name.- See Also:
getParams(),SerialRef
-
setBlob
public void setBlob(int parameterIndex, Blob x) throws SQLExceptionSets the designated parameter to the givenBlobobject in the Java programming language. The driver converts this to an SQLBLOBvalue when it sends it to the database. Internally, theBlobis represented as aSerialBlobto ensure serializability.The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces. NOTE:JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.After this method has been called, a call to the method
getParamswill return an object array of the current command parameters, which will include theBlobobject 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- aBlobobject representing an SQLBLOBvalue- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams(),SerialBlob
-
setClob
public void setClob(int parameterIndex, Clob x) throws SQLExceptionSets the designated parameter to the givenClobobject in the Java programming language. The driver converts this to an SQLCLOBvalue when it sends it to the database. Internally, theClobis represented as aSerialClobto ensure serializability.The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.After this method has been called, a call to the method
getParamswill return an object array of the current command parameters, which will include theClobobject 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- aClobobject representing an SQLCLOBvalue; cannot be null- Throws:
SQLException- if an error occurs; the parameter index is out of bounds or theClobis null- See Also:
getParams(),SerialBlob
-
setArray
public void setArray(int parameterIndex, Array array) throws SQLExceptionSets the designated parameter to anArrayobject in the Java programming language. The driver converts this to an SQLARRAYvalue when it sends it to the database. Internally, theArrayis represented as aSerialArrayto ensure serializability.The parameter value set by this method is stored internally and will be supplied as the appropriate parameter in this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.Note:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.After this method has been called, a call to the method
getParamswill return an object array of the current command parameters, which will include theArrayobject 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterarray- anArrayobject representing an SQLARRAYvalue; cannot be null. TheArrayobject passed to this method must return a non-null Object for allgetArray()method calls. A null value will cause aSQLExceptionto be thrown.- Throws:
SQLException- if an error occurs; the parameter index is out of bounds or theARRAYis null- See Also:
getParams(),SerialArray
-
setDate
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLExceptionSets the designated parameter to the givenjava.sql.Dateobject. When the DBMS does not store time zone information, the driver will use the givenCalendarobject to construct the SQLDATEvalue to send to the database. With aCalendarobject, the driver can calculate the date taking into account a custom time zone. If noCalendarobject 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsafter this version ofsetDatehas 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.Dateobject. 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- ajava.sql.Dateobject representing an SQLDATEvaluecal- ajava.util.Calendarobject to use when when constructing the date- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setTime
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLExceptionSets the designated parameter to the givenjava.sql.Timeobject. The driver converts this to an SQLTIMEvalue when it sends it to the database.When the DBMS does not store time zone information, the driver will use the given
Calendarobject to construct the SQLTIMEvalue to send to the database. With aCalendarobject, the driver can calculate the date taking into account a custom time zone. If noCalendarobject 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsafter this version ofsetTimehas 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.Timeobject. 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- ajava.sql.Timeobjectcal- thejava.util.Calendarobject the driver can use to construct the time- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
setTimestamp
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLExceptionSets the designated parameter to the givenjava.sql.Timestampobject. The driver converts this to an SQLTIMESTAMPvalue when it sends it to the database.When the DBMS does not store time zone information, the driver will use the given
Calendarobject to construct the SQLTIMESTAMPvalue to send to the database. With aCalendarobject, the driver can calculate the timestamp taking into account a custom time zone. If noCalendarobject 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 this
RowSetobject's command when the methodexecuteis called. Methods such asexecuteandpopulatemust be provided in any class that extends this class and implements one or more of the standard JSR-114RowSetinterfaces.NOTE:
JdbcRowSetdoes not require thepopulatemethod as it is undefined in this class.Calls made to the method
getParamsafter this version ofsetTimestamphas 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.Timestampobject. 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 thisRowSetobject's command that is to be set. The first parameter is 1, the second is 2, and so on; must be1or greaterx- ajava.sql.Timestampobjectcal- thejava.util.Calendarobject the driver can use to construct the timestamp- Throws:
SQLException- if an error occurs or the parameter index is out of bounds- See Also:
getParams()
-
clearParameters
public void clearParameters() throws SQLExceptionClears all of the current parameter values in thisRowSetobject's internal representation of the parameters to be set in thisRowSetobject's command when it is executed.In general, parameter values remain in force for repeated use in this
RowSetobject'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 the
setCommandmethod to clear all of the parameters set for the previous command.Furthermore, this method differs from the
initParamsmethod in that it maintains the schema of theRowSetobject.- Throws:
SQLException- if an error occurs clearing the parameters
-
getParams
public Object[] getParams() throws SQLException
Retrieves an array containing the parameter values (both Objects and primitives) that have been set for thisRowSetobject's command and throws anSQLExceptionobject 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 thePreparedStatementobject that is the command for aRowSetimplementation extending theBaseRowSetclass.Each element in the array that is returned is an
Objectinstance 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 types
Array,Blob,ClobandRefare returned asSerialArray,SerialBlob,SerialClobandSerialRefrespectively.- Returns:
- an array of
Objectinstances that includes the parameter values that may be set in thisRowSetobject's command; an empty array if no parameters have been set - Throws:
SQLException- if an error occurs retrieving the object array of parameters of thisRowSetobject or if not all parameters have been set
-
setNull
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 parametersqlType- the SQL type code defined injava.sql.Types- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method
-
setNull
public void setNull(String parameterName, int sqlType, String typeName) throws SQLException
Sets the designated parameter to SQLNULL. This version of the methodsetNullshould 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 parametersqlType- a value fromjava.sql.TypestypeName- the fully-qualified name of an SQL user-defined type; ignored if the parameter is not a user-defined type or SQLREFvalue- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method
-
setBoolean
public void setBoolean(String parameterName, boolean x) throws SQLException
Sets the designated parameter to the given Javabooleanvalue. The driver converts this to an SQLBITorBOOLEANvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setByte
public void setByte(String parameterName, byte x) throws SQLException
Sets the designated parameter to the given Javabytevalue. The driver converts this to an SQLTINYINTvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setShort
public void setShort(String parameterName, short x) throws SQLException
Sets the designated parameter to the given Javashortvalue. The driver converts this to an SQLSMALLINTvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setInt
public void setInt(String parameterName, int x) throws SQLException
Sets the designated parameter to the given Javaintvalue. The driver converts this to an SQLINTEGERvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setLong
public void setLong(String parameterName, long x) throws SQLException
Sets the designated parameter to the given Javalongvalue. The driver converts this to an SQLBIGINTvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setFloat
public void setFloat(String parameterName, float x) throws SQLException
Sets the designated parameter to the given Javafloatvalue. The driver converts this to an SQLFLOATvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- 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 Javadoublevalue. The driver converts this to an SQLDOUBLEvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setBigDecimal
public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException
Sets the designated parameter to the givenjava.math.BigDecimalvalue. The driver converts this to an SQLNUMERICvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setString
public void setString(String parameterName, String x) throws SQLException
Sets the designated parameter to the given JavaStringvalue. The driver converts this to an SQLVARCHARorLONGVARCHARvalue (depending on the argument's size relative to the driver's limits onVARCHARvalues) when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- 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 SQLVARBINARYorLONGVARBINARY(depending on the argument's size relative to the driver's limits onVARBINARYvalues) when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setTimestamp
public void setTimestamp(String parameterName, Timestamp x) throws SQLException
Sets the designated parameter to the givenjava.sql.Timestampvalue. The driver converts this to an SQLTIMESTAMPvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setAsciiStream
public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException
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 aLONGVARCHARparameter, 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 parameterx- the Java input stream that contains the ASCII parameter valuelength- the number of bytes in the stream- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method
-
setBinaryStream
public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException
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 aLONGVARBINARYparameter, it may be more practical to send it via ajava.io.InputStreamobject. 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 parameterx- the java input stream which contains the binary parameter valuelength- the number of bytes in the stream- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method
-
setCharacterStream
public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException
Sets the designated parameter to the givenReaderobject, which is the given number of characters long. When a very large UNICODE value is input to aLONGVARCHARparameter, it may be more practical to send it via ajava.io.Readerobject. 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 parameterreader- thejava.io.Readerobject that contains the UNICODE data used as the designated parameterlength- the number of characters in the stream- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method
-
setAsciiStream
public void setAsciiStream(String parameterName, InputStream x) throws SQLException
Sets the designated parameter to the given input stream. When a very large ASCII value is input to aLONGVARCHARparameter, 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 of
setAsciiStreamwhich takes a length parameter.- Parameters:
parameterName- the name of the parameterx- the Java input stream that contains the ASCII parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setBinaryStream
public void setBinaryStream(String parameterName, InputStream x) throws SQLException
Sets the designated parameter to the given input stream. When a very large binary value is input to aLONGVARBINARYparameter, it may be more practical to send it via ajava.io.InputStreamobject. 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 of
setBinaryStreamwhich takes a length parameter.- Parameters:
parameterName- the name of the parameterx- the java input stream which contains the binary parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setCharacterStream
public void setCharacterStream(String parameterName, Reader reader) throws SQLException
Sets the designated parameter to the givenReaderobject. When a very large UNICODE value is input to aLONGVARCHARparameter, it may be more practical to send it via ajava.io.Readerobject. 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 of
setCharacterStreamwhich takes a length parameter.- Parameters:
parameterName- the name of the parameterreader- thejava.io.Readerobject that contains the Unicode data- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNCharacterStream
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLExceptionSets the designated parameter in thisRowSetobject's command to aReaderobject. TheReaderreads 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 of
setNCharacterStreamwhich takes a length parameter.- Parameters:
parameterIndex- of the first parameter is 1, the second is 2, ...value- the parameter value- Throws:
SQLException- 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 closedPreparedStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setObject
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.langequivalent 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 interface
SQLData), the JDBC driver should call the methodSQLData.writeSQLto 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 parameterx- the object containing the input parameter valuetargetSqlType- 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- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- iftargetSqlTypeis aARRAY,BLOB,CLOB,DATALINK,JAVA_OBJECT,NCHAR,NCLOB,NVARCHAR,LONGNVARCHAR,REF,ROWID,SQLXMLorSTRUCTdata type and the JDBC driver does not support this data type- See Also:
Types,getParams()
-
setObject
public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException
Sets the value of the designated parameter with the given object. This method is like the methodsetObjectabove, except that it assumes a scale of zero.- Parameters:
parameterName- the name of the parameterx- the object containing the input parameter valuetargetSqlType- the SQL type (as defined in java.sql.Types) to be sent to the database- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- iftargetSqlTypeis aARRAY,BLOB,CLOB,DATALINK,JAVA_OBJECT,NCHAR,NCLOB,NVARCHAR,LONGNVARCHAR,REF,ROWID,SQLXMLorSTRUCTdata type and the JDBC driver does not support this data type- See Also:
getParams()
-
setObject
public void setObject(String parameterName, Object x) throws SQLException
Sets the value of the designated parameter with the given object. The second parameter must be of typeObject; therefore, thejava.langequivalent objects should be used for built-in types.The JDBC specification specifies a standard mapping from Java
Objecttypes 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 interface
SQLData, the JDBC driver should call the methodSQLData.writeSQLto 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 parameterx- the object containing the input parameter value- Throws:
SQLException- if a database access error occurs, this method is called on a closedCallableStatementor if the givenObjectparameter is ambiguousSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setBlob
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLExceptionSets the designated parameter to aInputStreamobject. TheInputStreammust contain the number of characters specified by length otherwise aSQLExceptionwill be generated when thePreparedStatementis 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 thesetBinaryStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARBINARYor 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- 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 theInputStreamdoes not match the specified length.SQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setBlob
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLExceptionSets the designated parameter to aInputStreamobject. 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 thesetBinaryStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARBINARYor aBLOBNote: Consult your JDBC driver documentation to determine if it might be more efficient to use a version of
setBlobwhich 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- if a database access error occurs, this method is called on a closedPreparedStatementor if parameterIndex does not correspond to a parameter marker in the SQL statement,SQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setBlob
public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException
Sets the designated parameter to aInputStreamobject. TheInputstreammust contain the number of characters specified by length, otherwise aSQLExceptionwill be generated when theCallableStatementis 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 thesetBinaryStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARBINARYor 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- 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 theInputStreamdoes not match the specified length; if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setBlob
public void setBlob(String parameterName, Blob x) throws SQLException
Sets the designated parameter to the givenjava.sql.Blobobject. The driver converts this to an SQLBLOBvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- aBlobobject that maps an SQLBLOBvalue- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setBlob
public void setBlob(String parameterName, InputStream inputStream) throws SQLException
Sets the designated parameter to aInputStreamobject. 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 thesetBinaryStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be send to the server as aLONGVARBINARYor aBLOBNote: Consult your JDBC driver documentation to determine if it might be more efficient to use a version of
setBlobwhich takes a length parameter.- Parameters:
parameterName- the name of the parameterinputStream- An object that contains the data to set the parameter value to.- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setClob
public void setClob(int parameterIndex, Reader reader, long length) throws SQLExceptionSets the designated parameter to aReaderobject. The reader must contain the number of characters specified by length otherwise aSQLExceptionwill be generated when thePreparedStatementis 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 thesetCharacterStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARCHARor 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- 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- if the JDBC driver does not support this method- Since:
- 1.6
-
setClob
public void setClob(int parameterIndex, Reader reader) throws SQLExceptionSets the designated parameter to aReaderobject. 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 thesetCharacterStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARCHARor aCLOBNote: Consult your JDBC driver documentation to determine if it might be more efficient to use a version of
setClobwhich 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- if a database access error occurs, this method is called on a closedPreparedStatementor if parameterIndex does not correspond to a parameter marker in the SQL statementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setClob
public void setClob(String parameterName, Reader reader, long length) throws SQLException
Sets the designated parameter to aReaderobject. Thereadermust contain the number of characters specified by length otherwise aSQLExceptionwill be generated when theCallableStatementis 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 thesetCharacterStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be send to the server as aLONGVARCHARor aCLOB- Parameters:
parameterName- the name of the parameter to be setreader- An object that contains the data to set the parameter value to.length- the number of characters in the parameter data.- Throws:
SQLException- 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 closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setClob
public void setClob(String parameterName, Clob x) throws SQLException
Sets the designated parameter to the givenjava.sql.Clobobject. The driver converts this to an SQLCLOBvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- aClobobject that maps an SQLCLOBvalue- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setClob
public void setClob(String parameterName, Reader reader) throws SQLException
Sets the designated parameter to aReaderobject. 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 thesetCharacterStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be send to the server as aLONGVARCHARor aCLOBNote: Consult your JDBC driver documentation to determine if it might be more efficient to use a version of
setClobwhich takes a length parameter.- Parameters:
parameterName- the name of the parameterreader- An object that contains the data to set the parameter value to.- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setDate
public void setDate(String parameterName, Date x) throws SQLException
Sets the designated parameter to the givenjava.sql.Datevalue using the default time zone of the virtual machine that is running the application. The driver converts this to an SQLDATEvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setDate
public void setDate(String parameterName, Date x, Calendar cal) throws SQLException
Sets the designated parameter to the givenjava.sql.Datevalue, using the givenCalendarobject. The driver uses theCalendarobject to construct an SQLDATEvalue, which the driver then sends to the database. With a aCalendarobject, the driver can calculate the date taking into account a custom timezone. If noCalendarobject is specified, the driver uses the default timezone, which is that of the virtual machine running the application.- Parameters:
parameterName- the name of the parameterx- the parameter valuecal- theCalendarobject the driver will use to construct the date- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setTime
public void setTime(String parameterName, Time x) throws SQLException
Sets the designated parameter to the givenjava.sql.Timevalue. The driver converts this to an SQLTIMEvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setTime
public void setTime(String parameterName, Time x, Calendar cal) throws SQLException
Sets the designated parameter to the givenjava.sql.Timevalue, using the givenCalendarobject. The driver uses theCalendarobject to construct an SQLTIMEvalue, which the driver then sends to the database. With a aCalendarobject, the driver can calculate the time taking into account a custom timezone. If noCalendarobject is specified, the driver uses the default timezone, which is that of the virtual machine running the application.- Parameters:
parameterName- the name of the parameterx- the parameter valuecal- theCalendarobject the driver will use to construct the time- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setTimestamp
public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException
Sets the designated parameter to the givenjava.sql.Timestampvalue, using the givenCalendarobject. The driver uses theCalendarobject to construct an SQLTIMESTAMPvalue, which the driver then sends to the database. With a aCalendarobject, the driver can calculate the timestamp taking into account a custom timezone. If noCalendarobject is specified, the driver uses the default timezone, which is that of the virtual machine running the application.- Parameters:
parameterName- the name of the parameterx- the parameter valuecal- theCalendarobject the driver will use to construct the timestamp- Throws:
SQLException- if a database access error occurs or this method is called on a closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- See Also:
getParams()
-
setSQLXML
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLExceptionSets the designated parameter to the givenjava.sql.SQLXMLobject. The driver converts this to an SQLXMLvalue when it sends it to the database.- Parameters:
parameterIndex- index of the first parameter is 1, the second is 2, ...xmlObject- aSQLXMLobject that maps an SQLXMLvalue- Throws:
SQLException- if a database access error occurs, this method is called on a closed result set, thejava.xml.transform.Result,WriterorOutputStreamhas not been closed for theSQLXMLobject or if there is an error processing the XML value. ThegetCausemethod of the exception may provide a more detailed exception, for example, if the stream does not contain valid XML.SQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setSQLXML
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException
Sets the designated parameter to the givenjava.sql.SQLXMLobject. The driver converts this to anSQL XMLvalue when it sends it to the database.- Parameters:
parameterName- the name of the parameterxmlObject- aSQLXMLobject that maps anSQL XMLvalue- Throws:
SQLException- if a database access error occurs, this method is called on a closed result set, thejava.xml.transform.Result,WriterorOutputStreamhas not been closed for theSQLXMLobject or if there is an error processing the XML value. ThegetCausemethod of the exception may provide a more detailed exception, for example, if the stream does not contain valid XML.SQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setRowId
public void setRowId(int parameterIndex, RowId x) throws SQLExceptionSets the designated parameter to the givenjava.sql.RowIdobject. The driver converts this to a SQLROWIDvalue when it sends it to the database- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
SQLException- if a database access error occursSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setRowId
public void setRowId(String parameterName, RowId x) throws SQLException
Sets the designated parameter to the givenjava.sql.RowIdobject. The driver converts this to a SQLROWIDwhen it sends it to the database.- Parameters:
parameterName- the name of the parameterx- the parameter value- Throws:
SQLException- if a database access error occursSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNString
public void setNString(int parameterIndex, String value) throws SQLExceptionSets the designated parameter to the givenStringobject. The driver converts this to a SQLNCHARorNVARCHARorLONGNVARCHARvalue (depending on the argument's size relative to the driver's limits onNVARCHARvalues) 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- 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 occursSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNString
public void setNString(String parameterName, String value) throws SQLException
Sets the designated parameter to the givenStringobject. The driver converts this to a SQLNCHARorNVARCHARorLONGNVARCHAR- Parameters:
parameterName- the name of the column to be setvalue- the parameter value- Throws:
SQLException- 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 occursSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNCharacterStream
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLExceptionSets the designated parameter to aReaderobject. TheReaderreads 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 valuelength- the number of characters in the parameter data.- Throws:
SQLException- 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 occursSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNCharacterStream
public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException
Sets the designated parameter to aReaderobject. TheReaderreads 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 setvalue- the parameter valuelength- the number of characters in the parameter data.- Throws:
SQLException- 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 occursSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNCharacterStream
public void setNCharacterStream(String parameterName, Reader value) throws SQLException
Sets the designated parameter to aReaderobject. TheReaderreads 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 of
setNCharacterStreamwhich takes a length parameter.- Parameters:
parameterName- the name of the parametervalue- the parameter value- Throws:
SQLException- 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 closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNClob
public void setNClob(String parameterName, NClob value) throws SQLException
Sets the designated parameter to ajava.sql.NClobobject. The object implements thejava.sql.NClobinterface. ThisNClobobject maps to a SQLNCLOB.- Parameters:
parameterName- the name of the column to be setvalue- the parameter value- Throws:
SQLException- 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 occursSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNClob
public void setNClob(String parameterName, Reader reader, long length) throws SQLException
Sets the designated parameter to aReaderobject. Thereadermust contain the number of characters specified by length otherwise aSQLExceptionwill be generated when theCallableStatementis 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 thesetCharacterStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be send to the server as aLONGNVARCHARor aNCLOB- Parameters:
parameterName- the name of the parameter to be setreader- An object that contains the data to set the parameter value to.length- the number of characters in the parameter data.- Throws:
SQLException- 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 closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNClob
public void setNClob(String parameterName, Reader reader) throws SQLException
Sets the designated parameter to aReaderobject. 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 thesetCharacterStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be send to the server as aLONGNVARCHARor aNCLOBNote: Consult your JDBC driver documentation to determine if it might be more efficient to use a version of
setNClobwhich takes a length parameter.- Parameters:
parameterName- the name of the parameterreader- An object that contains the data to set the parameter value to.- Throws:
SQLException- 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 closedCallableStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNClob
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLExceptionSets the designated parameter to aReaderobject. The reader must contain the number of characters specified by length otherwise aSQLExceptionwill be generated when thePreparedStatementis 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 thesetCharacterStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGNVARCHARor 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- 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 closedPreparedStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNClob
public void setNClob(int parameterIndex, NClob value) throws SQLExceptionSets the designated parameter to ajava.sql.NClobobject. The driver converts this oa SQLNCLOBvalue 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- 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 occursSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setNClob
public void setNClob(int parameterIndex, Reader reader) throws SQLExceptionSets the designated parameter to aReaderobject. 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 thesetCharacterStreammethod is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGNVARCHARor aNCLOBNote: Consult your JDBC driver documentation to determine if it might be more efficient to use a version of
setNClobwhich 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- 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 closedPreparedStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.6
-
setURL
public void setURL(int parameterIndex, URL x) throws SQLExceptionSets the designated parameter to the givenjava.net.URLvalue. The driver converts this to an SQLDATALINKvalue when it sends it to the database.- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- thejava.net.URLobject to be set- Throws:
SQLException- if a database access error occurs or this method is called on a closedPreparedStatementSQLFeatureNotSupportedException- if the JDBC driver does not support this method
-
-