src/share/classes/javax/sql/rowset/BaseRowSet.java

Print this page




  53  * <p>
  54  * The <code>BaseRowSet</code> class provides the following:
  55  *
  56  * <UL>
  57  * <LI><b>Properties</b>
  58  *     <ul>
  59  *     <li>Fields for storing current properties
  60  *     <li>Methods for getting and setting properties
  61  *     </ul>
  62  *
  63  * <LI><b>Event notification</b>
  64  *
  65  * <LI><b>A complete set of setter methods</b> for setting the parameters in a
  66  *      <code>RowSet</code> object's command
  67  *
  68  * <LI> <b>Streams</b>
  69  *  <ul>
  70  *  <li>Fields for storing stream instances
  71  *  <li>Constants for indicating the type of a stream
  72  *  </ul>
  73  *  <p>
  74  * </UL>
  75  *
  76  * <h3>2.0 Setting Properties</h3>
  77  * All rowsets maintain a set of properties, which will usually be set using
  78  * a tool.  The number and kinds of properties a rowset has will vary,
  79  * depending on what the <code>RowSet</code> implementation does and how it gets
  80  * its data.  For example,
  81  * rowsets that get their data from a <code>ResultSet</code> object need to
  82  * set the properties that are required for making a database connection.
  83  * If a <code>RowSet</code> object uses the <code>DriverManager</code> facility to make a
  84  * connection, it needs to set a property for the JDBC URL that identifies the
  85  * appropriate driver, and it needs to set the properties that give the
  86  * user name and password.
  87  * If, on the other hand, the rowset uses a <code>DataSource</code> object
  88  * to make the connection, which is the preferred method, it does not need to
  89  * set the property for the JDBC URL.  Instead, it needs to set the property
  90  * for the logical name of the data source along with the properties for
  91  * the user name and password.
  92  * <P>
  93  * NOTE:  In order to use a <code>DataSource</code> object for making a


 964      * type.  The default is <code>TYPE_SCROLL_INSENSITIVE</code>.
 965      *
 966      * @return the type of this JDBC <code>RowSet</code>
 967      *         object, which must be one of the following:
 968      *         <code>ResultSet.TYPE_FORWARD_ONLY</code>,
 969      *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
 970      *         <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
 971      * @throws SQLException if an error occurs getting the type of
 972      *     of this <code>RowSet</code> object
 973      * @see #setType
 974      */
 975     public int getType() throws SQLException {
 976         return rowSetType;
 977     }
 978 
 979     /**
 980      * Sets the concurrency for this <code>RowSet</code> object to
 981      * the specified concurrency. The default concurrency for any <code>RowSet</code>
 982      * object (connected or disconnected) is <code>ResultSet.CONCUR_UPDATABLE</code>,
 983      * but this method may be called at any time to change the concurrency.
 984      * <P>
 985      * @param concurrency one of the following constants:
 986      *                    <code>ResultSet.CONCUR_READ_ONLY</code> or
 987      *                    <code>ResultSet.CONCUR_UPDATABLE</code>
 988      * @throws SQLException if the parameter supplied is not one of the
 989      *         following constants:
 990      *          <code>ResultSet.CONCUR_UPDATABLE</code> or
 991      *          <code>ResultSet.CONCUR_READ_ONLY</code>
 992      * @see #getConcurrency
 993      * @see #isReadOnly
 994      */
 995     public void setConcurrency(int concurrency) throws SQLException {
 996 
 997         if((concurrency != ResultSet.CONCUR_READ_ONLY) &&
 998            (concurrency != ResultSet.CONCUR_UPDATABLE)) {
 999                 throw new SQLException("Invalid concurrency set. Must be either " +
1000                 "ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE.");
1001         }
1002         this.concurrency = concurrency;
1003     }
1004 


1402      * <code>ResultSet</code> object's default fetch size is set by
1403      * the <code>Statement</code> object that created it.
1404      * <P>
1405      * This method applies to a <code>RowSet</code> object only while it is
1406      * connected to a database using a JDBC driver.
1407      * For connected <code>RowSet</code> implementations such as
1408      * <code>JdbcRowSet</code>, this method has a direct and immediate effect
1409      * on the underlying JDBC driver.
1410      * <P>
1411      * A <code>RowSet</code> object may use this method at any time to change
1412      * its setting for the fetch size.
1413      * <p>
1414      * For <code>RowSet</code> implementations such as
1415      * <code>CachedRowSet</code>, which operate in a disconnected environment,
1416      * the <code>SyncProvider</code> object being used
1417      * may leverage the fetch size to poll the data source and
1418      * retrieve a number of rows that do not exceed the fetch size and that may
1419      * form a subset of the actual rows returned by the original query. This is
1420      * an implementation variance determined by the specific <code>SyncProvider</code>
1421      * object employed by the disconnected <code>RowSet</code> object.
1422      * <P>
1423      *
1424      * @param rows the number of rows to fetch; <code>0</code> to let the
1425      *        driver decide what the best fetch size is; must not be less
1426      *        than <code>0</code> or more than the maximum number of rows
1427      *        allowed for this <code>RowSet</code> object (the number returned
1428      *        by a call to the method {@link #getMaxRows})
1429      * @throws SQLException if the specified fetch size is less than <code>0</code>
1430      *        or more than the limit for the maximum number of rows
1431      * @see #getFetchSize
1432      */
1433     public void setFetchSize(int rows) throws SQLException {
1434         //Added this checking as maxRows can be 0 when this function is called
1435         //maxRows = 0 means rowset can hold any number of rows, os this checking
1436         // is needed to take care of this condition.
1437         if (getMaxRows() == 0 && rows >= 0)  {
1438             fetchSize = rows;
1439             return;
1440         }
1441         if ((rows < 0) || (rows > getMaxRows())) {
1442             throw new SQLException("Invalid fetch size set. Cannot be of " +


1449      * Returns the fetch size for this <code>RowSet</code> object. The default
1450      * value is zero.
1451      *
1452      * @return the number of rows suggested as the fetch size when this <code>RowSet</code> object
1453      *     needs more rows from the database
1454      * @throws SQLException if an error occurs determining the number of rows in the
1455      *     current fetch size
1456      * @see #setFetchSize
1457      */
1458     public int getFetchSize() throws SQLException {
1459         return fetchSize;
1460     }
1461 
1462     /**
1463      * Returns the concurrency for this <code>RowSet</code> object.
1464      * The default is <code>CONCUR_UPDATABLE</code> for both connected and
1465      * disconnected <code>RowSet</code> objects.
1466      * <P>
1467      * An application can call the method <code>setConcurrency</code> at any time
1468      * to change a <code>RowSet</code> object's concurrency.
1469      * <p>
1470      * @return the concurrency type for this <code>RowSet</code>
1471      *     object, which must be one of the following:
1472      *     <code>ResultSet.CONCUR_READ_ONLY</code> or
1473      *     <code>ResultSet.CONCUR_UPDATABLE</code>
1474      * @throws SQLException if an error occurs getting the concurrency
1475      *     of this <code>RowSet</code> object
1476      * @see #setConcurrency
1477      * @see #isReadOnly
1478      */
1479     public int getConcurrency() throws SQLException {
1480         return concurrency;
1481     }
1482 
1483     //-----------------------------------------------------------------------
1484     // Parameters
1485     //-----------------------------------------------------------------------
1486 
1487     /**
1488      * Checks the given index to see whether it is less than <code>1</code> and
1489      * throws an <code>SQLException</code> object if it is.


1720             throw new SQLException("Set initParams() before setByte");
1721        }
1722 
1723         params.put(Integer.valueOf(parameterIndex - 1), Byte.valueOf(x));
1724     }
1725 
1726     /**
1727      * Sets the designated parameter to the given <code>short</code> in the
1728      * Java programming language.  The driver converts this to an SQL
1729      * <code>SMALLINT</code> value when it sends it to the database.
1730      * <P>
1731      * The parameter value set by this method is stored internally and
1732      * will be supplied as the appropriate parameter in this <code>RowSet</code>
1733      * object's command when the method <code>execute</code> is called.
1734      * Methods such as <code>execute</code> and <code>populate</code> must be
1735      * provided in any class that extends this class and implements one or
1736      * more of the standard JSR-114 <code>RowSet</code> interfaces.
1737      * <p>
1738      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1739      * as it is undefined in this class.
1740      * <p>
1741      * @param parameterIndex the ordinal number of the placeholder parameter
1742      *        in this <code>RowSet</code> object's command that is to be set.
1743      *        The first parameter is 1, the second is 2, and so on; must be
1744      *        <code>1</code> or greater
1745      * @param x the parameter value
1746      * @throws SQLException if an error occurs or the
1747      *                         parameter index is out of bounds
1748      * @see #getParams
1749      */
1750     public void setShort(int parameterIndex, short x) throws SQLException {
1751         checkParamIndex(parameterIndex);
1752 
1753         if(params == null){
1754              throw new SQLException("Set initParams() before setShort");
1755         }
1756 
1757         params.put(Integer.valueOf(parameterIndex - 1), Short.valueOf(x));
1758     }
1759 
1760     /**


1850         if(params == null){
1851              throw new SQLException("Set initParams() before setFloat");
1852         }
1853         params.put(Integer.valueOf(parameterIndex - 1), Float.valueOf(x));
1854     }
1855 
1856     /**
1857      * Sets the designated parameter to the given <code>double</code> in the
1858      * Java programming language.  The driver converts this to an SQL
1859      * <code>DOUBLE</code> value when it sends it to the database.
1860      * <P>
1861      * The parameter value set by this method is stored internally and
1862      * will be supplied as the appropriate parameter in this <code>RowSet</code>
1863      * object's command when the method <code>execute</code> is called.
1864      * Methods such as <code>execute</code> and <code>populate</code> must be
1865      * provided in any class that extends this class and implements one or
1866      * more of the standard JSR-114 <code>RowSet</code> interfaces.
1867      * <P>
1868      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1869      * as it is undefined in this class.
1870      * S
1871      * @param parameterIndex the ordinal number of the placeholder parameter
1872      *        in this <code>RowSet</code> object's command that is to be set.
1873      *        The first parameter is 1, the second is 2, and so on; must be
1874      *        <code>1</code> or greater
1875      * @param x the parameter value
1876      * @throws SQLException if an error occurs or the
1877      *                         parameter index is out of bounds
1878      * @see #getParams
1879      */
1880     public void setDouble(int parameterIndex, double x) throws SQLException {
1881         checkParamIndex(parameterIndex);
1882         if(params == null){
1883              throw new SQLException("Set initParams() before setDouble");
1884         }
1885         params.put(Integer.valueOf(parameterIndex - 1), Double.valueOf(x));
1886     }
1887 
1888     /**
1889      * Sets the designated parameter to the given
1890      * <code>java.lang.BigDecimal</code> value.  The driver converts this to


1916         }
1917         params.put(Integer.valueOf(parameterIndex - 1), x);
1918     }
1919 
1920     /**
1921      * Sets the designated parameter to the given <code>String</code>
1922      * value.  The driver converts this to an SQL
1923      * <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
1924      * (depending on the argument's size relative to the driver's limits
1925      * on <code>VARCHAR</code> values) when it sends it to the database.
1926      * <P>
1927      * The parameter value set by this method is stored internally and
1928      * will be supplied as the appropriate parameter in this <code>RowSet</code>
1929      * object's command when the method <code>execute</code> is called.
1930      * Methods such as <code>execute</code> and <code>populate</code> must be
1931      * provided in any class that extends this class and implements one or
1932      * more of the standard JSR-114 <code>RowSet</code> interfaces.
1933      * <p>
1934      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1935      * as it is undefined in this class.
1936      * <p>
1937      * @param parameterIndex the ordinal number of the placeholder parameter
1938      *        in this <code>RowSet</code> object's command that is to be set.
1939      *        The first parameter is 1, the second is 2, and so on; must be
1940      *        <code>1</code> or greater
1941      * @param x the parameter value
1942      * @throws SQLException if an error occurs or the
1943      *                         parameter index is out of bounds
1944      * @see #getParams
1945      */
1946     public void setString(int parameterIndex, String x) throws SQLException {
1947         checkParamIndex(parameterIndex);
1948         if(params == null){
1949              throw new SQLException("Set initParams() before setString");
1950         }
1951         params.put(Integer.valueOf(parameterIndex - 1), x);
1952     }
1953 
1954     /**
1955      * Sets the designated parameter to the given array of bytes.
1956      * The driver converts this to an SQL


3634     * @param parameterName the name of the parameter
3635     * @param reader the <code>java.io.Reader</code> object that contains the
3636     *        Unicode data
3637     * @exception SQLException if a database access error occurs or
3638     * this method is called on a closed <code>CallableStatement</code>
3639     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
3640     * @since 1.6
3641     */
3642    public void setCharacterStream(String parameterName,
3643                          java.io.Reader reader) throws SQLException{
3644         throw new SQLFeatureNotSupportedException("Feature not supported");
3645    }
3646 
3647 
3648  /**
3649   * Sets the designated parameter in this <code>RowSet</code> object's command
3650   * to a <code>Reader</code> object. The
3651   * <code>Reader</code> reads the data till end-of-file is reached. The
3652   * driver does the necessary conversion from Java character format to
3653   * the national character set in the database.
3654 
3655   * <P><B>Note:</B> This stream object can either be a standard
3656   * Java stream object or your own subclass that implements the
3657   * standard interface.
3658   * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
3659   * it might be more efficient to use a version of
3660   * <code>setNCharacterStream</code> which takes a length parameter.
3661   *
3662   * @param parameterIndex of the first parameter is 1, the second is 2, ...
3663   * @param value the parameter value
3664   * @throws SQLException if the driver does not support national
3665   *         character sets;  if the driver can detect that a data conversion
3666   *  error could occur ; if a database access error occurs; or
3667   * this method is called on a closed <code>PreparedStatement</code>
3668   * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
3669   * @since 1.6
3670   */
3671   public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException{
3672         throw new SQLFeatureNotSupportedException("Feature not supported");
3673    }
3674 




  53  * <p>
  54  * The <code>BaseRowSet</code> class provides the following:
  55  *
  56  * <UL>
  57  * <LI><b>Properties</b>
  58  *     <ul>
  59  *     <li>Fields for storing current properties
  60  *     <li>Methods for getting and setting properties
  61  *     </ul>
  62  *
  63  * <LI><b>Event notification</b>
  64  *
  65  * <LI><b>A complete set of setter methods</b> for setting the parameters in a
  66  *      <code>RowSet</code> object's command
  67  *
  68  * <LI> <b>Streams</b>
  69  *  <ul>
  70  *  <li>Fields for storing stream instances
  71  *  <li>Constants for indicating the type of a stream
  72  *  </ul>

  73  * </UL>
  74  *
  75  * <h3>2.0 Setting Properties</h3>
  76  * All rowsets maintain a set of properties, which will usually be set using
  77  * a tool.  The number and kinds of properties a rowset has will vary,
  78  * depending on what the <code>RowSet</code> implementation does and how it gets
  79  * its data.  For example,
  80  * rowsets that get their data from a <code>ResultSet</code> object need to
  81  * set the properties that are required for making a database connection.
  82  * If a <code>RowSet</code> object uses the <code>DriverManager</code> facility to make a
  83  * connection, it needs to set a property for the JDBC URL that identifies the
  84  * appropriate driver, and it needs to set the properties that give the
  85  * user name and password.
  86  * If, on the other hand, the rowset uses a <code>DataSource</code> object
  87  * to make the connection, which is the preferred method, it does not need to
  88  * set the property for the JDBC URL.  Instead, it needs to set the property
  89  * for the logical name of the data source along with the properties for
  90  * the user name and password.
  91  * <P>
  92  * NOTE:  In order to use a <code>DataSource</code> object for making a


 963      * type.  The default is <code>TYPE_SCROLL_INSENSITIVE</code>.
 964      *
 965      * @return the type of this JDBC <code>RowSet</code>
 966      *         object, which must be one of the following:
 967      *         <code>ResultSet.TYPE_FORWARD_ONLY</code>,
 968      *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
 969      *         <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
 970      * @throws SQLException if an error occurs getting the type of
 971      *     of this <code>RowSet</code> object
 972      * @see #setType
 973      */
 974     public int getType() throws SQLException {
 975         return rowSetType;
 976     }
 977 
 978     /**
 979      * Sets the concurrency for this <code>RowSet</code> object to
 980      * the specified concurrency. The default concurrency for any <code>RowSet</code>
 981      * object (connected or disconnected) is <code>ResultSet.CONCUR_UPDATABLE</code>,
 982      * but this method may be called at any time to change the concurrency.
 983      *
 984      * @param concurrency one of the following constants:
 985      *                    <code>ResultSet.CONCUR_READ_ONLY</code> or
 986      *                    <code>ResultSet.CONCUR_UPDATABLE</code>
 987      * @throws SQLException if the parameter supplied is not one of the
 988      *         following constants:
 989      *          <code>ResultSet.CONCUR_UPDATABLE</code> or
 990      *          <code>ResultSet.CONCUR_READ_ONLY</code>
 991      * @see #getConcurrency
 992      * @see #isReadOnly
 993      */
 994     public void setConcurrency(int concurrency) throws SQLException {
 995 
 996         if((concurrency != ResultSet.CONCUR_READ_ONLY) &&
 997            (concurrency != ResultSet.CONCUR_UPDATABLE)) {
 998                 throw new SQLException("Invalid concurrency set. Must be either " +
 999                 "ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE.");
1000         }
1001         this.concurrency = concurrency;
1002     }
1003 


1401      * <code>ResultSet</code> object's default fetch size is set by
1402      * the <code>Statement</code> object that created it.
1403      * <P>
1404      * This method applies to a <code>RowSet</code> object only while it is
1405      * connected to a database using a JDBC driver.
1406      * For connected <code>RowSet</code> implementations such as
1407      * <code>JdbcRowSet</code>, this method has a direct and immediate effect
1408      * on the underlying JDBC driver.
1409      * <P>
1410      * A <code>RowSet</code> object may use this method at any time to change
1411      * its setting for the fetch size.
1412      * <p>
1413      * For <code>RowSet</code> implementations such as
1414      * <code>CachedRowSet</code>, which operate in a disconnected environment,
1415      * the <code>SyncProvider</code> object being used
1416      * may leverage the fetch size to poll the data source and
1417      * retrieve a number of rows that do not exceed the fetch size and that may
1418      * form a subset of the actual rows returned by the original query. This is
1419      * an implementation variance determined by the specific <code>SyncProvider</code>
1420      * object employed by the disconnected <code>RowSet</code> object.

1421      *
1422      * @param rows the number of rows to fetch; <code>0</code> to let the
1423      *        driver decide what the best fetch size is; must not be less
1424      *        than <code>0</code> or more than the maximum number of rows
1425      *        allowed for this <code>RowSet</code> object (the number returned
1426      *        by a call to the method {@link #getMaxRows})
1427      * @throws SQLException if the specified fetch size is less than <code>0</code>
1428      *        or more than the limit for the maximum number of rows
1429      * @see #getFetchSize
1430      */
1431     public void setFetchSize(int rows) throws SQLException {
1432         //Added this checking as maxRows can be 0 when this function is called
1433         //maxRows = 0 means rowset can hold any number of rows, os this checking
1434         // is needed to take care of this condition.
1435         if (getMaxRows() == 0 && rows >= 0)  {
1436             fetchSize = rows;
1437             return;
1438         }
1439         if ((rows < 0) || (rows > getMaxRows())) {
1440             throw new SQLException("Invalid fetch size set. Cannot be of " +


1447      * Returns the fetch size for this <code>RowSet</code> object. The default
1448      * value is zero.
1449      *
1450      * @return the number of rows suggested as the fetch size when this <code>RowSet</code> object
1451      *     needs more rows from the database
1452      * @throws SQLException if an error occurs determining the number of rows in the
1453      *     current fetch size
1454      * @see #setFetchSize
1455      */
1456     public int getFetchSize() throws SQLException {
1457         return fetchSize;
1458     }
1459 
1460     /**
1461      * Returns the concurrency for this <code>RowSet</code> object.
1462      * The default is <code>CONCUR_UPDATABLE</code> for both connected and
1463      * disconnected <code>RowSet</code> objects.
1464      * <P>
1465      * An application can call the method <code>setConcurrency</code> at any time
1466      * to change a <code>RowSet</code> object's concurrency.
1467      *
1468      * @return the concurrency type for this <code>RowSet</code>
1469      *     object, which must be one of the following:
1470      *     <code>ResultSet.CONCUR_READ_ONLY</code> or
1471      *     <code>ResultSet.CONCUR_UPDATABLE</code>
1472      * @throws SQLException if an error occurs getting the concurrency
1473      *     of this <code>RowSet</code> object
1474      * @see #setConcurrency
1475      * @see #isReadOnly
1476      */
1477     public int getConcurrency() throws SQLException {
1478         return concurrency;
1479     }
1480 
1481     //-----------------------------------------------------------------------
1482     // Parameters
1483     //-----------------------------------------------------------------------
1484 
1485     /**
1486      * Checks the given index to see whether it is less than <code>1</code> and
1487      * throws an <code>SQLException</code> object if it is.


1718             throw new SQLException("Set initParams() before setByte");
1719        }
1720 
1721         params.put(Integer.valueOf(parameterIndex - 1), Byte.valueOf(x));
1722     }
1723 
1724     /**
1725      * Sets the designated parameter to the given <code>short</code> in the
1726      * Java programming language.  The driver converts this to an SQL
1727      * <code>SMALLINT</code> value when it sends it to the database.
1728      * <P>
1729      * The parameter value set by this method is stored internally and
1730      * will be supplied as the appropriate parameter in this <code>RowSet</code>
1731      * object's command when the method <code>execute</code> is called.
1732      * Methods such as <code>execute</code> and <code>populate</code> must be
1733      * provided in any class that extends this class and implements one or
1734      * more of the standard JSR-114 <code>RowSet</code> interfaces.
1735      * <p>
1736      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1737      * as it is undefined in this class.
1738      *
1739      * @param parameterIndex the ordinal number of the placeholder parameter
1740      *        in this <code>RowSet</code> object's command that is to be set.
1741      *        The first parameter is 1, the second is 2, and so on; must be
1742      *        <code>1</code> or greater
1743      * @param x the parameter value
1744      * @throws SQLException if an error occurs or the
1745      *                         parameter index is out of bounds
1746      * @see #getParams
1747      */
1748     public void setShort(int parameterIndex, short x) throws SQLException {
1749         checkParamIndex(parameterIndex);
1750 
1751         if(params == null){
1752              throw new SQLException("Set initParams() before setShort");
1753         }
1754 
1755         params.put(Integer.valueOf(parameterIndex - 1), Short.valueOf(x));
1756     }
1757 
1758     /**


1848         if(params == null){
1849              throw new SQLException("Set initParams() before setFloat");
1850         }
1851         params.put(Integer.valueOf(parameterIndex - 1), Float.valueOf(x));
1852     }
1853 
1854     /**
1855      * Sets the designated parameter to the given <code>double</code> in the
1856      * Java programming language.  The driver converts this to an SQL
1857      * <code>DOUBLE</code> value when it sends it to the database.
1858      * <P>
1859      * The parameter value set by this method is stored internally and
1860      * will be supplied as the appropriate parameter in this <code>RowSet</code>
1861      * object's command when the method <code>execute</code> is called.
1862      * Methods such as <code>execute</code> and <code>populate</code> must be
1863      * provided in any class that extends this class and implements one or
1864      * more of the standard JSR-114 <code>RowSet</code> interfaces.
1865      * <P>
1866      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1867      * as it is undefined in this class.
1868      *
1869      * @param parameterIndex the ordinal number of the placeholder parameter
1870      *        in this <code>RowSet</code> object's command that is to be set.
1871      *        The first parameter is 1, the second is 2, and so on; must be
1872      *        <code>1</code> or greater
1873      * @param x the parameter value
1874      * @throws SQLException if an error occurs or the
1875      *                         parameter index is out of bounds
1876      * @see #getParams
1877      */
1878     public void setDouble(int parameterIndex, double x) throws SQLException {
1879         checkParamIndex(parameterIndex);
1880         if(params == null){
1881              throw new SQLException("Set initParams() before setDouble");
1882         }
1883         params.put(Integer.valueOf(parameterIndex - 1), Double.valueOf(x));
1884     }
1885 
1886     /**
1887      * Sets the designated parameter to the given
1888      * <code>java.lang.BigDecimal</code> value.  The driver converts this to


1914         }
1915         params.put(Integer.valueOf(parameterIndex - 1), x);
1916     }
1917 
1918     /**
1919      * Sets the designated parameter to the given <code>String</code>
1920      * value.  The driver converts this to an SQL
1921      * <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
1922      * (depending on the argument's size relative to the driver's limits
1923      * on <code>VARCHAR</code> values) when it sends it to the database.
1924      * <P>
1925      * The parameter value set by this method is stored internally and
1926      * will be supplied as the appropriate parameter in this <code>RowSet</code>
1927      * object's command when the method <code>execute</code> is called.
1928      * Methods such as <code>execute</code> and <code>populate</code> must be
1929      * provided in any class that extends this class and implements one or
1930      * more of the standard JSR-114 <code>RowSet</code> interfaces.
1931      * <p>
1932      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1933      * as it is undefined in this class.
1934      *
1935      * @param parameterIndex the ordinal number of the placeholder parameter
1936      *        in this <code>RowSet</code> object's command that is to be set.
1937      *        The first parameter is 1, the second is 2, and so on; must be
1938      *        <code>1</code> or greater
1939      * @param x the parameter value
1940      * @throws SQLException if an error occurs or the
1941      *                         parameter index is out of bounds
1942      * @see #getParams
1943      */
1944     public void setString(int parameterIndex, String x) throws SQLException {
1945         checkParamIndex(parameterIndex);
1946         if(params == null){
1947              throw new SQLException("Set initParams() before setString");
1948         }
1949         params.put(Integer.valueOf(parameterIndex - 1), x);
1950     }
1951 
1952     /**
1953      * Sets the designated parameter to the given array of bytes.
1954      * The driver converts this to an SQL


3632     * @param parameterName the name of the parameter
3633     * @param reader the <code>java.io.Reader</code> object that contains the
3634     *        Unicode data
3635     * @exception SQLException if a database access error occurs or
3636     * this method is called on a closed <code>CallableStatement</code>
3637     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
3638     * @since 1.6
3639     */
3640    public void setCharacterStream(String parameterName,
3641                          java.io.Reader reader) throws SQLException{
3642         throw new SQLFeatureNotSupportedException("Feature not supported");
3643    }
3644 
3645 
3646  /**
3647   * Sets the designated parameter in this <code>RowSet</code> object's command
3648   * to a <code>Reader</code> object. The
3649   * <code>Reader</code> reads the data till end-of-file is reached. The
3650   * driver does the necessary conversion from Java character format to
3651   * the national character set in the database.
3652   *
3653   * <P><B>Note:</B> This stream object can either be a standard
3654   * Java stream object or your own subclass that implements the
3655   * standard interface.
3656   * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
3657   * it might be more efficient to use a version of
3658   * <code>setNCharacterStream</code> which takes a length parameter.
3659   *
3660   * @param parameterIndex of the first parameter is 1, the second is 2, ...
3661   * @param value the parameter value
3662   * @throws SQLException if the driver does not support national
3663   *         character sets;  if the driver can detect that a data conversion
3664   *  error could occur ; if a database access error occurs; or
3665   * this method is called on a closed <code>PreparedStatement</code>
3666   * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
3667   * @since 1.6
3668   */
3669   public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException{
3670         throw new SQLFeatureNotSupportedException("Feature not supported");
3671    }
3672