Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.sql
Interface Clob

public interface Clob

The mapping in the JavaTM programming language for the SQL `CLOB` type. An SQL `CLOB` is a built-in type that stores a Character Large Object as a column value in a row of a database table. The driver implements a `Clob` object using an SQL `locator(CLOB)`, which means that a `Clob` object contains a logical pointer to the SQL `CLOB` data rather than the data itself. A `Clob` object is valid for the duration of the transaction in which it was created.

The `Clob` interface provides methods for getting the length of an SQL `CLOB` (Character Large Object) value, for materializing a `CLOB` value on the client, and for searching for a substring or `CLOB` object within a `CLOB` value. Methods in the interfaces `ResultSet`, `CallableStatement`, and `PreparedStatement`, such as `getClob` and `setClob` allow a programmer to access an SQL `CLOB` value.

This class is new in the JDBC 2.0 API.

Method Summary
`InputStream` | `getAsciiStream()` Gets the `CLOB` value designated by this `Clob` object as a stream of Ascii bytes.
`Reader` | `getCharacterStream()` Gets the `CLOB` value designated by this `Clob` object as a Unicode stream.
`String` | `getSubString(long pos, int length)` Returns a copy of the specified substring in the `CLOB` value designated by this `Clob` object.
`long` | `length()` Returns the number of characters in the `CLOB` value designated by this `Clob` object.
`long` | `position(Clob searchstr, long start)` Determines the character position at which the specified `Clob` object `searchstr` appears in this `Clob` object.
`long` | `position(String searchstr, long start)` Determines the character position at which the specified substring `searchstr` appears in the SQL `CLOB` value represented by this `Clob` object.

Method Detail

### length

    public long length()
                throws SQLException

  Returns the number of characters in the `CLOB` value designated by this `Clob` object.
  Returns:
    length of the `CLOB` in characters
  Throws:
    `SQLException` - if there is an error accessing the length of the `CLOB`
  Since:
    1.2
  See Also:
    What Is in the JDBC 2.0 API

### getSubString

    public String getSubString(long pos,
                               int length)
                        throws SQLException

  Returns a copy of the specified substring in the `CLOB` value designated by this `Clob` object. The substring begins at position `pos` and has up to `length` consecutive characters.
  Parameters:
    `pos` - the first character of the substring to be extracted. The first character is at position 1.
    `length` - the number of consecutive characters to be copied
  Returns:
    a `String` that is the specified substring in the `CLOB` value designated by this `Clob` object
  Throws:
    `SQLException` - if there is an error accessing the `CLOB`
  Since:
    1.2
  See Also:
    What Is in the JDBC 2.0 API

### getCharacterStream

    public Reader getCharacterStream()
                              throws SQLException

  Gets the `CLOB` value designated by this `Clob` object as a Unicode stream.
  Returns:
    a Unicode stream containing the `CLOB` data
  Throws:
    `SQLException` - if there is an error accessing the `CLOB` value
  Since:
    1.2
  See Also:
    What Is in the JDBC 2.0 API

### getAsciiStream

    public InputStream getAsciiStream()
                               throws SQLException

  Gets the `CLOB` value designated by this `Clob` object as a stream of Ascii bytes.
  Returns:
    an ascii stream containing the `CLOB` data
  Throws:
    `SQLException` - if there is an error accessing the `CLOB` value
  Since:
    1.2
  See Also:
    What Is in the JDBC 2.0 API

### position

    public long position(String searchstr,
                         long start)
                  throws SQLException

  Determines the character position at which the specified substring `searchstr` appears in the SQL `CLOB` value represented by this `Clob` object. The search begins at position `start`.
  Parameters:
    `searchstr` - the substring for which to search
    `start` - the position at which to begin searching; the first position is 1
  Returns:
    the position at which the substring appears, else -1; the first position is 1
  Throws:
    `SQLException` - if there is an error accessing the `CLOB` value
  Since:
    1.2
  See Also:
    What Is in the JDBC 2.0 API

### position

    public long position(Clob searchstr,
                         long start)
                  throws SQLException

  Determines the character position at which the specified `Clob` object `searchstr` appears in this `Clob` object. The search begins at position `start`.
  Parameters:
    `searchstr` - the `Clob` object for which to search
    `start` - the position at which to begin searching; the first position is 1
  Returns:
    the position at which the `Clob` object appears, else -1; the first position is 1
  Throws:
    `SQLException` - if there is an error accessing the `CLOB` value
  Since:
    1.2
  See Also:
    What Is in the JDBC 2.0 API

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.