JDBC API Reference

This reference provides information about the JDBC 3 API. All JDBC 3–compliant drivers are required to support this API.

Note 

The interfaces and classes in this reference are sorted alphabetically, as are the attributes and methods that they provide. Repeated method names indicate that several method signatures are available for the same purpose, each one supporting a different set of parameters. Those parameters and the return values are described as well in this reference.

Interface Array

public interface Array

The Array object is valid only during the transaction where it is used. It is a pointer to the data in the SQL ARRAY field; it doesn’t actually contain the array elements. There are methods available to access the elements of the array as either an array or a JDBC ResultSet object. By default, the elements are mapped using the standard mapping for data types, but you can provide a custom map to the methods getArray() and getResultSet().

Methods

getArray

public Object getArray() throws SQLException

This returns a Java array containing the values of the elements of the SQL ARRAY using the type map associated with the connection.

Returns: The array of values contained in the SQL ARRAY. A SQLException is thrown if the values cannot be accessed.

getArray

public Object getArray(java.util.Map map) throws SQLException

This returns a Java array containing the values of the elements of the SQL ARRAY using the type map passed as a parameter. If no user-defined type is defined for the array’s base type, the standard mapping is used.

Parameters:

map:

A java.util.Map object containing mappings of SQL type names to Java classes

Returns: A Java array containing the ordered elements of the SQL array designated by this object. A SQLException is thrown if the values cannot be accessed.

getArray

public Object getArray(long index, int count) throws SQLException

This returns a Java array containing the values of the subset of elements of the SQL ARRAY determined by the index and element count parameters using the type map associated with the connection.

Parameters:

index:

The index of the first element to return begins at 1.

count:

The number of elements of the SQL array elements to return.

Returns: An array containing count elements of the SQL array, starting at element index. A SQLException is thrown if the values cannot be accessed.

getArray

public Object getArray(long index, int count,  java.util.Map map) throws SQLException

This returns a Java array containing the values of the subset of elements of the SQL ARRAY determined by the index and element count parameters using the type map passed as a parameter. If no user-defined type is defined for the array’s base type, the standard mapping is used.

Parameters:

index:

The index of the first element to return begins at 1.

count:

The number of elements of the SQL array elements to return.

map:

A java.util.Map object containing mappings of SQL type names to Java classes.

Returns: An array containing count elements of the SQL array, starting at element index. A SQLException is thrown if the values cannot be accessed.

getBaseType

public int getBaseType() throws SQLException

This gets the JDBC type of the elements in the array.

Returns: A java.sql.Types constant. A SQLException is thrown if the type name cannot be returned.

getBaseTypeName

public String getBaseTypeName() throws SQLException

This gets the type name of the elements in the array. These elements can be of a specific database type or a user-defined type. When a user-defined type is used, the method returns the SQL type name for the elements in the array.

Returns: The database-specific name for a built-in base type or the fully qualified SQL type name for a user-defined type. A SQLException is thrown if the type name cannot be returned.

getResultSet

public ResultSet getResultSet() throws SQLException

This returns a ResultSet object containing the values of the elements of the SQL ARRAY using the type map associated with the connection. Each row of the ResultSet contains the index of the array element as the first column and the value of the element as the second column.

Returns: A ResultSet object containing a row for each element in the array. A SQLException is thrown if the values cannot be accessed.

getResultSet

public ResultSet getResultSet(java.util.Map map) throws SQLException

This returns a ResultSet object containing the values of the elements of the SQL ARRAY using the type map passed as a parameter. If no user-defined type is defined for the array’s base type, the standard mapping is used. Each row of the ResultSet contains the index of the array element as the first column and the value of the element as the second column.

Parameters:

map:

A java.util.Map object containing mappings of SQL type names to Java classes

Returns: A ResultSet object containing a row for each element in the array. A SQLException is thrown if the values cannot be accessed.

getResultSet

public ResultSet getResultSet(long index, int count) throws SQLException

This returns a ResultSet object containing the values of the subset of elements of the SQL ARRAY determined by the index and element count parameters using the type map associated with the connection. Each row of the ResultSet contains the index of the array element as the first column and the value of the element as the second column.

Parameters:

index:

The index of the first element to return begins at 1.

count:

The number of elements of the SQL array elements to return.

Returns: A ResultSet containing count elements of the SQL array, starting at element index. A SQLException is thrown if the values cannot be accessed.

getResultSet

public ResultSet getResultSet(long index, int count,  java.util.Map map) throws SQLException

This returns a ResultSet object containing the values of the subset of elements of the SQL ARRAY determined by the index and element count parameters using the type map passed as a parameter. If no user-defined type is defined for the array’s base type, the standard mapping is used. Each row of the ResultSet contains the index of the array element as the first column and the value of the element as the second column.

Parameters:

index:

The index of the first element to return begins at 1.

count:

The number of elements of the SQL array elements to return.

map:

A java.util.Map object containing mappings of SQL type names to Java classes.

Returns: A ResultSet containing count elements of the SQL array, starting at element index. A SQLException is thrown if the values cannot be accessed.



JDBC 3. 0. JAVA Database Connectivity
JDBC 3: Java Database Connectivity
ISBN: 0764548751
EAN: 2147483647
Year: 2002
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net