|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packagejava.sql
as colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
Class Array, Object getArray()JDBC 2.0The mapping in the Java programming language for the SQL type
ARRAY
. By default anArray
object is a transaction-duration reference to an SQLarrayARRAY
value. By default anArray
object is implemented using an SQL LOCATOR(array) internally which means that anArray
object contains a logical pointer to the data in the SQLARRAY
value on the server rather than containing theARRAY
value's data.The
Array
interface provides methods for bringing an SQLARRAY
value's data to the client as either an array or aResultSet
object.If the elements of the SQL
ARRAY
are a UDT they may be custom mapped. To create a custom mapping a programmer must do two things:
- create a class that implements the SQLData interface for the UDT to be custom mapped. This will typically be done using a tool.
- make an entry in a type map that contains
- the fully-qualified SQL type name of the UDT
- the
Class
object for the class implementingSQLData
When a type map with an entry for the base type is supplied to the methods
getArray
andgetResultSet
the mapping it contains will be used to map the elements of theARRAY
value. If no type map is supplied which would typically be the case the connection's type map is used by default. If the connection's type map or a type map supplied to a method has no entry for the base type the elements are mapped according to the standard mapping.NOTE: This interface is new in the JDBC 2.0 API
.
Retrieves the contents of the SQLClass Array, Object getArray(Map)arrayARRAY
value designated by thisArray
object in the form of an array in the Java programming language. This version of the methodgetArray
uses the type map associated with the connection for customizations of the type mappings. @return an array in the Java programming language that contains the ordered elements of the SQLARRAY
objectvalue designated by this object @exception SQLException if an error occurs while attempting to access the array @since 1.2 @see What Is in the JDBC 2.0 API
Retrieves the contents of the SQL array designated by thisClass Array, Object getArray(long, int)Array
object. Thisusingmethod uses the specifiedmap
for type map customizations.Ifunless the base type of the array does not match a user-defined type inmap
in which case it uses the standard mapping. This version of the methodgetArray
uses either the given type map or the standard mapping; it never usesisthe type map associatedusedwith theinsteadconnection. @param map ajava.util.Map
object that contains mappings of SQL type names to classes in the Java programming language @return an array in the Java programming language that contains the ordered elements of the SQL array designated by this object @exception SQLException if an error occurs while attempting to access the array @since 1.2 @see What Is in the JDBC 2.0 API
Returns an array containing a slice of the SQLClass Array, Object getArray(long, int, Map)arrayARRAY
value designated by thisArray
object beginning with the specifiedindex
and containing up tocount
successive elements of the SQL array. This method uses the type-map associated with the connection for customizations of the type-mappings. @param index the array index of the first element to retrieve; the first element is at index 1 @param count the number of successive SQL array elements to retrieve @return an array containing up tocount
consecutive elements of the SQL array beginning with elementindex
@exception SQLException if an error occurs while attempting to access the array @since 1.2 @see What Is in the JDBC 2.0 API
Returns an array containing a slice of the SQL array object designated by thisClass Array, int getBaseType()Array
object beginning with the specifiedindex
and containing up tocount
successive elements of the SQL array.This method uses the specified
map
for type-map customizations unless the base type of the array does not match a user-defined type inmap
in which case it uses the standard mapping. This version of the methodgetArray
uses either the given type map or the standard mapping; it never uses the type map associated with the connection. @param index the array index of the first element to retrieve; the first element is at index 1 @param count the number of successive SQL array elements to retrieve @param map ajava.util.Map
object that contains SQL type names and the classes in the Java programming language to which they are mapped @return an array containing up tocount
consecutive elements of the SQL array designated by thisArray
object beginning with elementindex
. @exception SQLException if an error occurs while attempting to access the array @since 1.2 @see What Is in the JDBC 2.0 API
Returns the JDBC type of the elements in the array designated by thisClass Array, String getBaseTypeName()Array
object. @return a constant from the class java.sql.Types that is the type code for the elements in the array designated by thisArray
object. @exception SQLException if an error occurs while attempting to access the base type @since 1.2 @see What Is in the JDBC 2.0 API
Returns the SQL type name of the elements in the array designated by thisClass Array, ResultSet getResultSet()Array
object. If the elements are a built-in type it returns the database-specific type name of the elements. If the elements are a user-defined type (UDT) this method returns the fully-qualified SQL type name. @return aString
that is the database-specific name for a built-in base type or the fully-qualified SQL type name for a base type that is a UDT @exception SQLException if an error occurs while attempting to access the type name @since 1.2 @see What Is in the JDBC 2.0 API
Returns a result set that contains the elements of theClass Array, ResultSet getResultSet(Map)arraySQLARRAY
value designated by thisArray
object. If appropriate the elements of the array are mapped using the connection's type map; otherwise the standard mapping is used.The result set contains one row for each array element with two columns in each row. The second column stores the element value; the first column stores the index into the array for that element (with the first array element being at index 1). The rows are in ascending order corresponding to the order of the indices. @return a ResultSet object containing one row for each of the elements in the array designated by this
Array
object with the rows in ascending order based on the indices. @exception SQLException if an error occurs while attempting to access the array @since 1.2 @see What Is in the JDBC 2.0 API
Returns a result set that contains the elements of theClass Array, ResultSet getResultSet(long, int)arraySQLARRAY
value designated by thisArray
object. Thisandmethod uses thegivenspecifiedmap
to mapforthe arraytype mapelements.customizationsIfunless the base type of the array does not match a user-defined type inmap
in which case it uses the standard mapping. This version of the methodgetResultSet
uses either the given type map or the standard mapping; itisnever uses the type map associated withused insteadthe connection.The result set contains one row for each array element with two columns in each row. The second column stores the element value; the first column stores the index into the array for that element (with the first array element being at index 1). The rows are in ascending order corresponding to the order of the indices. @param map contains the mapping of SQL user-defined types to classes in the Java
(tm)programming language @return aResultSet
object containing one row for each of the elements in the array designated by thisArray
object with the rows in ascending order based on the indices. @exception SQLException if an error occurs while attempting to access the array @since 1.2 @see What Is in the JDBC 2.0 API
Returns a result set holding the elements of the subarray that starts at indexClass Array, ResultSet getResultSet(long, int, Map)index
and contains up tocount
successive elements. This method uses the connection's type map to map the elements of the array if the map contains an entry for the base type. Otherwise the standard mapping is used.The result set has one row for each element of the SQL array designated by this object with the first row containing the element at index
index
. The result set has up tocount
rows in ascending order based on the indices. Each row has two columns: The second column stores the element value; the first columnstroesstores the index into the array for that element. @param index the array index of the first element to retrieve; the first element is at index 1 @param count the number of successive SQL array elements to retrieve @return aResultSet
object containing up tocount
consecutive elements of the SQL array designated by thisArray
object starting at indexindex
. @exception SQLException if an error occurs while attempting to access the array @since 1.2 @see What Is in the JDBC 2.0 API
Returns a result set holding the elements of the subarray that starts at indexindex
and contains up tocount
successive elements. This method uses theMapspecifiedobjectmap
to map the elementsforof the arraytype map customizations unless the base type of the array does not match a user-defined type inmap
in which case it uses the standard mapping. This version of the methodgetResultSet
uses either the given type map or the standard mapping; it never uses the type map associated with the connection.The result set has one row for each element of the SQL array designated by this object with the first row containing the element at index
index
. The result set has up tocount
rows in ascending order based on the indices. Each row has two columns: The second column stores the element value; the first column stroes the index into the array for that element. @param index the array index of the first element to retrieve; the first element is at index 1 @param count the number of successive SQL array elements to retrieve @param map theMap
object that contains the mapping of SQL type names to classes in the Java(tm) programming language @return aResultSet
object containing up tocount
consecutive elements of the SQL array designated by thisArray
object starting at indexindex
. @exception SQLException if an error occurs while attempting to access the array @since 1.2 @see What Is in the JDBC 2.0 API
Class BatchUpdateException, constructor BatchUpdateException()JDBC 2.0An exception thrown when an error occurs during a batch update operation. In addition to the information provided by SQLException aBatchUpdateException
provides the update counts for all commands that were executed successfully during the batch update that is all commands that were executed before the error occurred. The order of elements in an array of update counts corresponds to the order in which commands were added to the batch.After a command in a batch update fails to execute properly and a
BatchUpdateException
is thrown the driver may or may not continue to process the remaining commands in the batch. If the driver continues processing after a failure the array returned by the methodBatchUpdateException.getUpdateCounts
will have an element for every command in the batch rather than only elements for the commands that executed successfully before the error. In the case where the driver continues processing commands the array element for any command that failed is-3
.This class is new in the JDBC 2.0 API.
Constructs aClass BatchUpdateException, constructor BatchUpdateException(String, String, int, int[])BatchUpdateException
object with the reason SQLState and update count initialized tonull
and the vendor code initialized to 0. @since 1.2 @see What Is in the JDBC 2.0 API
Constructs a fullyClass BatchUpdateException, constructor BatchUpdateException(String, String, int[])-specifiedBatchUpdateException
object initializing it with the given values. @param reason a description of the error @param SQLState an X/OPEN code identifying the error @param vendorCode an exception codeforused by a particular database vendor @param updateCounts an array ofint
with each element indicating the update count for a SQL command that executed successfully before the exception was thrown @since 1.2 @see What Is in the JDBC 2.0 API
Constructs aClass BatchUpdateException, constructor BatchUpdateException(String, int[])BatchUpdateException
initialized with the given arguments (reason
SQLState
andupdateCounts
) and 0 for the vendor code. @param reason a description of the exception @param SQLState an X/OPEN code identifying the exception @param updateCounts an array ofint
with each element indicating the update count for a SQL command that executed successfully before the exception was thrown @since 1.2 @see What Is in the JDBC 2.0 API
Constructs aClass BatchUpdateException, constructor BatchUpdateException(int[])BatchUpdateException
initialized withreason
updateCounts
andnull
for the SQLState and 0 for the vendorCode. @param reason a description of the exception @param updateCounts an array ofint
with each element indicating the update count for a SQL command that executed successfully before the exception was thrown @since 1.2 @see What Is in the JDBC 2.0 API
Constructs aClass BatchUpdateException, int[] getUpdateCounts()BatchUpdateException
initialized tonull
for the reason and SQLState and 0 for the vendor code. @param updateCounts an array ofint
with each element indicating the update count for a SQL command that executed successfully before the exception was thrown @since 1.2 @see What Is in the JDBC 2.0 API
Retrieves the update count for each update statement in the batch update that executed successfully before this exception occurred. A driver that implements batch updates may or may not continue to process the remaining commands in a batch when one of the commands fails to execute properly. If the driver continues processing commands the array returned by this method will have as many elements as there are commands in the batch; otherwise it will contain an update count for each command that executed successfully before theBatchUpdateException
was thrown.The possible return values for this method were modified for the Java 2 SDK Standard Edition version 1.3. This was done to accommodate the new option of continuing to process commands in a batch update after a
@return an array ofBatchUpdateException
object has been thrown.int
containing the update counts for the updates that were executed successfully before this error occurred. Or if the driver continues to process commands after an error one of the following for every command in the batch:@since 1.3 @see What Is in the JDBC 2.0 API
- an update count
-2
to indicate that the command executed successfully but the number of rows affected is unknown-3
to indicate that the command failed to execute successfully
Class Blob, InputStream getBinaryStream()JDBC 2.0The representation (mapping) in the JavaTM programming language of an SQLBLOB
value. An SQLBLOB
is a built-in type that stores a Binary Large Object as a column value in a row of a database table. The driver implementsBlob
using an SQLlocator(BLOB)
which means that aBlob
object contains a logical pointer to the SQLBLOB
data rather than the data itself. ABlob
object is valid for the duration of the transaction in which is was created.Methods in the interfaces ResultSet CallableStatement and PreparedStatement such as
getBlob
andsetBlob
allow a programmer to accessthean SQLBLOB
value. TheBlob
interface provides methods for getting the length of an SQLBLOB
(Binary Large Object) value for materializing aBLOB
value on the client and for determining the position of a pattern of bytes within aBLOB
value.This class is new in the JDBC 2.0 API. @since 1.2
Retrieves theClass Blob, byte[] getBytes(long, int)BLOB
designated by thisBlob
instance as a stream. @return a stream containing theBLOB
data @exception SQLException if there is an error accessing theBLOB
@since 1.2 @see What Is in the JDBC 2.0 API
Returns as an array of bytes part or all of theClass Blob, long length()BLOB
value that thisBlob
object designates. The byte array contains up tolength
consecutive bytes starting at positionpos
. @param pos the ordinal position of the first byte in theBLOB
value to be extracted; the first byte is at position 1 @param lengthisthe number of consecutive bytes to be copied @return a byte array containing up tolength
consecutive bytes from theBLOB
value designated by thisBlob
object starting with the byte at positionpos
.@exception SQLException if there is an error accessing theBLOB
@since 1.2 @see What Is in the JDBC 2.0 API
Returns the number of bytes in theClass Blob, long position(Blob, long)BLOB
value designated by thisBlob
object. @return length of theBLOB
in bytes @exception SQLException if there is an error accessing the length of theBLOB
@since 1.2 @see What Is in the JDBC 2.0 API
Determines the byte position in theClass Blob, long position(byte[], long)BLOB
value designated by thisBlob
object at whichpattern
begins. The search begins at positionstart
. @param pattern theBlob
object designating theBLOB
value for which to search @param start the position in theBLOB
value at which to begin searching; the first position is 1 @return the position at which the pattern begins else -1 @exception SQLException if there is an error accessing theBLOB
@since 1.2 @see What Is in the JDBC 2.0 API
Determines the byte position at which the specified bytepattern
begins within theBLOB
value that thisBlob
object represents. The search forpattern
begins at positionstart. @param pattern the byte array for which to search @param start the position at which to begin searching; the first position is 1 @return the position at which the pattern appears else -1
.@exception SQLException if there is an error accessing theBLOB
@since 1.2 @see What Is in the JDBC 2.0 API
The interface used to execute SQL stored procedures. JDBC provides a stored procedure SQL escape syntax that allows stored procedures to be called in a standard way for all RDBMSs. This escape syntax has one form that includes a result parameter and one that does not. If used the result parameter must be registered as an OUT parameter. The other parameters can be used for input output or both. Parameters are referred to sequentially by numberClass CallableStatement, Array getArray(int).Thewith the first parameterisbeing 1.
{ = call <procedure-name>[<arg1> <arg2> ...]} {call <procedure-name>[<arg1> <arg2> ...]}IN parameter values are set using the set methods inherited from PreparedStatement The type of all OUT parameters must be registered prior to executing the stored procedure; their values are retrieved after execution via the
get
methods provided here.A
CallableStatement
can return one ResultSet or multipleResultSet
objetsobjects. MultipleResultSet
objects are handled using operations inherited from StatementFor maximum portability a call's
ResultSet
objects and update counts should be processed prior to getting the values of output parameters.Methods that are new in the JDBC 2.0 API are marked "Since 1.2." @see Connection#prepareCall @see ResultSet
Class CallableStatement, BigDecimal getBigDecimal(int)JDBC 2.0Gets the value of a JDBCARRAY
parameter as an Array object in the Java programming language. @param i the first parameter is 1 the second is 2 and so on @return the parameter value as anArray
object in the Java programming language. If the value was SQLNULL
the valuenull
is returned. @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class CallableStatement, BigDecimal getBigDecimal(int, int)JDBC 2.0Gets the value of a JDBCNUMERIC
parameter as ajava.math.BigDecimal
object with as many digits to the right of the decimal point as the value contains. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value in full precision. If the value is SQLNULL
the result isnull
. @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value of a JDBCClass CallableStatement, Blob getBlob(int)NUMERIC
parameter as ajava.math.BigDecimal
object with scale digits to the right of the decimal point. @param parameterIndex the first parameter is 1 the second is 2 and so on @param scale the number of digits to the right of the decimal point @return the parameter value. If the value is SQLNULL
the result isnull
. @exception SQLException if a database access error occurs @deprecated
Class CallableStatement, boolean getBoolean(int)JDBC 2.0Gets the value of a JDBCBLOB
parameter as a Blob object in the Java programming language. @param i the first parameter is 1 the second is 2 and so on @return the parameter value as aBlob
object in the Java programming language. If the value was SQLNULL
the valuenull
is returned. @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value of a JDBCClass CallableStatement, byte getByte(int)BIT
parameter as aboolean
in the Java programming language. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result isfalse
. @exception SQLException if a database access error occurs
Gets the value of a JDBCClass CallableStatement, byte[] getBytes(int)TINYINT
parameter as abyte
in the Java programming language. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result is 0. @exception SQLException if a database access error occurs
Gets the value of a JDBCClass CallableStatement, Clob getClob(int)BINARY
orVARBINARY
parameter as an array ofbyte
vlauresvalues in the Java programming language. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result isnull
. @exception SQLException if a database access error occurs
Class CallableStatement, Date getDate(int)JDBC 2.0Gets the value of a JDBCCLOB
parameter as aClob
object in the Java programming language. @param i the first parameter is 1 the second is 2 and so on @return the parameter value as aClob
object in the Java programming language. If the value was SQLNULL
the valuenull
is returned. @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value of a JDBCClass CallableStatement, Date getDate(int, Calendar)DATE
parameter as ajava.sql.Date
object. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result isnull
. @exception SQLException if a database access error occurs
Gets the value of a JDBCClass CallableStatement, double getDouble(int)DATE
parameter as ajava.sql.Date
object using the givenCalendar
object to construct the date. With aCalendar
object the driver can calculate the date taking into account a custom timezone and locale. If noCalendar
object is specified the driver uses the default timezone and locale. @param parameterIndex the first parameter is 1 the second is 2 and so on @param cal theCalendar
object the driver will use to construct the date @return the parameter value. If the value is SQLNULL
the result isnull
. @exception SQLException if a database access error occurs
Gets the value of a JDBCClass CallableStatement, float getFloat(int)DOUBLE
parameter as adouble
in the Java programming language. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result is 0. @exception SQLException if a database access error occurs
Gets the value of a JDBCClass CallableStatement, int getInt(int)FLOAT
parameter as afloat
in the Java programming language. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result is 0. @exception SQLException if a database access error occurs
Gets the value of a JDBCClass CallableStatement, long getLong(int)INTEGER
parameter as anint
in the Java programming language. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result is 0. @exception SQLException if a database access error occurs
Gets the value of a JDBCClass CallableStatement, Object getObject(int)BIGINT
parameter as along
in the Java programming language. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result is 0. @exception SQLException if a database access error occurs
Gets the value of a parameter as anClass CallableStatement, Object getObject(int, Map)objectObject
in the Java programming language.This method returns a Java object whose type corresponds to the JDBC type that was registered for this parameter using the method
registerOutParameter
. By registering the target JDBC type asjava.sql.Types.OTHER
this method can be used to read database-specific abstract data types. @param parameterIndexThethe first parameter is 1 the second is 2 and so on @return Ajava.lang.Object
holding the OUT parameter value. @exception SQLException if a database access error occurs @see Types
Class CallableStatement, Ref getRef(int)JDBC 2.0Returns an object representing the value of OUT parameteri
and usesmap
for the custom mapping of the parameter value.This method returns a Java object whose type corresponds to the JDBC type that was registered for this parameter using the method
registerOutParameter
. By registering the target JDBC type asjava.sql.Types.OTHER
this method can be used to read database-specific abstract data types. @param i the first parameter is 1 the second is 2 and so on @param map the mapping from SQL type names to Java classes @return ajava.lang.Object
holding the OUT parameter value.@exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class CallableStatement, short getShort(int)JDBC 2.0Gets the value of a JDBCREF(<structured-type>)
parameter as a Ref object in the Java programming language. @param i the first parameter is 1 the second is 2 and so on @return the parameter value as aRef
object in the Java programming language. If the value was SQLNULL
the valuenull
is returned. @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value of a JDBCClass CallableStatement, String getString(int)SMALLINT
parameter as ashort
in the Java programming language. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result is 0. @exception SQLException if a database access error occurs
Retrieves the value of a JDBCClass CallableStatement, Time getTime(int)CHAR
VARCHAR
orLONGVARCHAR
parameter as aString
in the Java programming language.For the fixed-length type JDBC
CHAR
theString
object returned has exactly the same value the JDBCCHAR
value had in the database including any padding added by the database. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result isnull
. @exception SQLException if a database access error occurs
Get the value of a JDBCClass CallableStatement, Time getTime(int, Calendar)TIME
parameter as ajava.sql.Time
object. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result isnull
. @exception SQLException if a database access error occurs
Gets the value of a JDBCClass CallableStatement, Timestamp getTimestamp(int)TIME
parameter as ajava.sql.Time
object using the givenCalendar
object to construct the time. With aCalendar
object the driver can calculate the time taking into account a custom timezone and locale. If noCalendar
object is specified the driver uses the default timezone and locale. @param parameterIndex the first parameter is 1 the second is 2 and so on @param cal theCalendar
object the driver will use to construct the time @return the parameter value; if the value is SQLNULL
the result isnull
. @exception SQLException if a database access error occurs
Gets the value of a JDBCClass CallableStatement, Timestamp getTimestamp(int, Calendar)TIMESTAMP
parameter as ajava.sql.Timestamp
object. @param parameterIndex the first parameter is 1 the second is 2 and so on @return the parameter value. If the value is SQLNULL
the result isnull
. @exception SQLException if a database access error occurs
Gets the value of a JDBCClass CallableStatement, void registerOutParameter(int, int)TIMESTAMP
parameter as ajava.sql.Timestamp
object using the givenCalendar
object to construct theTimestamp
object. With aCalendar
object the driver can calculate the timestamp taking into account a custom timezone and locale. If noCalendar
object is specified the driver uses the default timezone and locale. @param parameterIndex the first parameter is 1 the second is 2 and so on @param cal theCalendar
object the driver will use to construct the timestamp @return the parameter value. If the value is SQLNULL
the result isnull
. @exception SQLException if a database access error occurs
Registers the OUT parameter in ordinal positionClass CallableStatement, void registerOutParameter(int, int, String)parameterIndex
to the JDBC typesqlType
. All OUT parameters must be registered before a stored procedure is executed.The JDBC type specified by
sqlType
for an OUT parameter determines the Java type that must be used in theget
method to read the value of that parameter.If the JDBC type expected to be returned to this output parameter is specific to this particular database
sqlType
should bejava.sql.Types.OTHER
. The method #getObject retrieves the value. @param parameterIndex the first parameter is 1 the second is 2 and so on @param sqlType the JDBC type code defined byjava.sql.Types
. If the parameter is of JDBC typeNumericNUMERIC
orDecimalDECIMAL
the version ofregisterOutParameter
that accepts a scale value should be used. @exception SQLException if a database access error occurs @see Types
Class CallableStatement, boolean wasNull()JDBC 2.0Registers the designated output parameter. This version of the methodregisterOutParameter
should be used for a user-named or REF output parameter. Examples of user-named types include: STRUCT DISTINCT JAVA_OBJECT and named array types. Before executing a stored procedure call you must explicitly callregisterOutParameter
to register the type fromjava.sql.Types
for each OUT parameter. For a user-named parameter the fully-qualified SQL type name of the parameter should also be given while a REF parameter requires that the fully-qualified type name of the referenced type be given. A JDBC driver that does not need the type code and type name information may ignore it. To be portable however applications should always provide these values for user-named and REF parameters. Although it is intended for user-named and REF parameters this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-named or REF type the typeName parameter is ignored.Note: When reading the value of an out parameter you must use the
getXXX
method whose Java type XXX corresponds to the parameter's registered SQL type. @param parameterIndex the first parameter is 1 the second is 2 ... @param sqlType a value from java.sql.Types @param typeName the fully-qualified name of an SQL structured type @exception SQLException if a database-access error occurs @see Types @since 1.2 @see What Is in the JDBC 2.0 API
Indicates whether or not the last OUT parameter read had the value of SQLNULL
. Note that this method should be called only after callingtheamethod; otherwise there is no value to use in determining whether it is
getgetXXXnull
or not. @returntrue
if the last parameter read was SQLNULL
;false
otherwise.@exception SQLException if a database access error occurs
Class Clob, InputStream getAsciiStream()JDBC 2.0The mapping in the JavaTM programming language for the SQLCLOB
type. An SQLCLOB
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 aClob
object using an SQLlocator(CLOB)
which means that aClob
object contains a logical pointer to the SQLCLOB
data rather than the data itself. AClob
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 SQLCLOB
(Character Large Object) value for materializing aCLOB
value on the client and for searching for a substring orCLOB
object within aCLOB
value. Methods in the interfaces ResultSet CallableStatement and PreparedStatement such asgetClob
andsetClob
allow a programmer to accessthean SQLCLOB
value.This class is new in the JDBC 2.0 API
.
Gets theClass Clob, Reader getCharacterStream()CLOB
value designated by thisClob
object as a stream of Ascii bytes. @return an ascii stream containing theCLOB
data @exception SQLException if there is an error accessing theCLOB
value @since 1.2 @see What Is in the JDBC 2.0 API
Gets theClass Clob, String getSubString(long, int)CLOB
value designated by thisClob
contentsobject as a Unicode stream. @return a Unicode stream containing theCLOB
data @exception SQLException if there is an error accessing theCLOB
value @since 1.2 @see What Is in the JDBC 2.0 API
Returns a copy of the specified substring in theClass Clob, long length()CLOB
value designated by thisClob
object. The substring begins at positionpos
and has up tolength
consecutive characters. @param pos the first character of the substring to be extracted. The first character is at position 1. @param length the number of consecutive characters to be copied @return aString
that is the specified substring in theCLOB
value designated by thisClob
object @exception SQLException if there is an error accessing theCLOB
@since 1.2 @see What Is in the JDBC 2.0 API
Returns the number of characters in theClass Clob, long position(Clob, long)CLOB
value designated by thisClob
object. @return length of theCLOB
in characters @exception SQLException if there is an error accessing the length of theCLOB
@since 1.2 @see What Is in the JDBC 2.0 API
Determines the character position at which the specifiedClass Clob, long position(String, long)Clob
objectsearchstr
appears in thisClob
object. The search begins at positionstart
. @param searchstr theClob
object for which to search @param start the position at which to begin searching; the first position is 1 @return the position at which theClob
object appears else -1; the first position is 1 @exception SQLException if there is an error accessing theCLOB
value @since 1.2 @see What Is in the JDBC 2.0 API
Determines the character position at which the specified substringsearchstr
appears in the SQLCLOB
value represented by thisClob
object. The search begins at positionstart
. @param searchstr the substring for which to search @param start the position at which to begin searching; the first position is 1 @return the position at which the substring appears else -1; the first position is 1 @exception SQLException if there is an error accessing theCLOB
value @since 1.2 @see What Is in the JDBC 2.0 API
Class Connection, Statement createStatement()A connection (session) with a specific database. Within the context of a Connection SQL statements are executed and results are returned.
A Connection's database is able to provide information describing its tables its supported SQL grammar its stored procedures the capabilities of this connection and so on. This information is obtained with the
getMetaData
method.Note: By default the Connection automatically commits changes after executing each statement. If auto commit has been disabled
an explicitthe methodcommit
must bedonecalledorexplicitly; otherwise database changes will not be saved. @see DriverManager#getConnection @see Statement @see ResultSet @see DatabaseMetaDataMethods that are new in the JDBC 2.0 API are tagged @since 1.2.
Creates aClass Connection, Statement createStatement(int, int)Statement
object for sending SQL statements to the database. SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times it is more efficient to use aPreparedStatement
JDBC2object.0Result sets created using the returnedStatement
object will by default have forward-only type and read-only concurrencyby default. @return a new Statement object @exception SQLException if a database access error occurs
Class Connection, Map getTypeMap()JDBC 2.0Creates aStatement
object that will generateResultSet
objects with the given type and concurrency. This method is the same as thecreateStatement
method above but it allows the default result set type and result set concurrency type to be overridden. @param resultSetType a result set type; see ResultSet.TYPE_XXX @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX @return a new Statement object @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class Connection, CallableStatement prepareCall(String)JDBC 2.0Gets the type map object associated with this connection. Unless the application has added an entry to the type map the map returned will be empty. @return thejava.util.Map
object associated with thisConnection
object @since 1.2 @see What Is in the JDBC 2.0 API
Creates aClass Connection, CallableStatement prepareCall(String, int, int)CallableStatement
object for calling database stored procedures. TheCallableStatement
object provides methods for setting up its IN and OUT parameters and methods for executing the call to a stored procedure.Note: This method is optimized for handling stored procedure call statements. Some drivers may send the call statement to the database when the method
prepareCall
is done; others may wait until theCallableStatement
object is executed. This has no direct effect on users; however it does affect which method throws certain SQLExceptions.JDBC 2.0Result sets created using the returned CallableStatement will have forward-only type and read-only concurrency by default. @param sql a SQL statement that may contain one or more ' ' parameter placeholders. Typically this statement is a JDBC function call escape string. @return a new CallableStatement object containing the pre-compiled SQL statement @exception SQLException if a database access error occurs
Class Connection, PreparedStatement prepareStatement(String)JDBC 2.0Creates aCallableStatement
object that will generateResultSet
objects with the given type and concurrency. This method is the same as theprepareCall
method above but it allows the default result set type and result set concurrency type to be overridden. @param resultSetType a result set type; see ResultSet.TYPE_XXX @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX @return a new CallableStatement object containing the pre-compiled SQL statement @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Creates aClass Connection, PreparedStatement prepareStatement(String, int, int)PreparedStatement
object for sending parameterized SQL statements to the database. A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation the method
prepareStatement
will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case the statement may not be sent to the database until thePreparedStatement
is executed. This has no direct effect on users; however it does affect which method throws certain SQLExceptions.JDBC 2.0Result sets created using the returned PreparedStatement will have forward-only type and read-only concurrency by default. @param sql a SQL statement that may contain one or more ' ' IN parameter placeholders @return a new PreparedStatement object containing the pre-compiled statement @exception SQLException if a database access error occurs
Class Connection, void setTypeMap(Map)JDBC 2.0Creates aPreparedStatement
object that will generateResultSet
objects with the given type and concurrency. This method is the same as theprepareStatement
method above but it allows the default result set type and result set concurrency type to be overridden. @param resultSetType a result set type; see ResultSet.TYPE_XXX @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX @return a new PreparedStatement object containing the pre-compiled SQL statement @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
JDBC 2.0Installs the given type map as the type map for this connection. The type map will be used for the custom mapping of SQL structured types and distinct types. @param thejava.util.Map
object to install as the replacement for thisConnection
object's default type map @since 1.2 @see What Is in the JDBC 2.0 API
Comprehensive information about the database as a whole.Class DatabaseMetaData, boolean deletesAreDetected(int)Many of the methods here return lists of information in the form of
ResultSet
objects. You can use the normalResultSet
methods such as getString and getInt to retrieve the data from theseResultSetsResultSet
. If a given form of metadata is not available these methods should throw an SQLException.Some of these methods take arguments that are String patterns. These arguments all have names such as fooPattern. Within a pattern String "%" means match any substring of 0 or more characters and "_" means match any one character. Only metadata entries matching the search pattern are returned. If a search pattern argument is set to a null ref that argument's criteria will be dropped from the search.
An
SQLException
will be thrown if a driver does not support a meta data method. In the case of methods that return aResultSet
either aResultSet
(which may be empty) is returned or a SQLException is thrown.
Class DatabaseMetaData, ResultSet getBestRowIdentifier(String, String, String, int, boolean)JDBC 2.0Indicates whether or not a visible row delete can be detected by calling ResultSet.rowDeleted(). If deletesAreDetected() returns false then deleted rows are removed from the result set. @param result set type i.e. ResultSet.TYPE_XXX @return true if changes are detected by the resultset type @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets a description of a table's optimal set of columns that uniquely identifies a row. They are ordered by SCOPE.Class DatabaseMetaData, ResultSet getCatalogs()Each column description has the following columns:
@param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schema a schema name; "" retrieves those without a schema @param table a table name @param scope the scope of interest; use same values as SCOPE @param nullable include columns that are nullable @return
- SCOPE short => actual scope of result
- bestRowTemporary - very temporary while using row
- bestRowTransaction - valid for remainder of current transaction
- bestRowSession - valid for remainder of current session
- COLUMN_NAME String => column name
- DATA_TYPE short => SQL data type from java.sql.Types
- TYPE_NAME String => Data source dependent type name for a UDT the type name is fully qualified
- COLUMN_SIZE int => precision
- BUFFER_LENGTH int => not used
- DECIMAL_DIGITS short => scale
- PSEUDO_COLUMN short => is this a pseudo column like an Oracle ROWID
- bestRowUnknown - may or may not be pseudo column
- bestRowNotPseudo - is NOT a pseudo column
- bestRowPseudo - is a pseudo column
ResultSet
- each row is a column description @exception SQLException if a database access error occurs
Gets the catalog names available in this database. The results are ordered by catalog name.Class DatabaseMetaData, ResultSet getColumnPrivileges(String, String, String, String)The catalog column is:
@return
- TABLE_CAT String => catalog name
ResultSet
- each row has a single String column that is a catalog name @exception SQLException if a database access error occurs
Gets a description of the access rights for a table's columns.Class DatabaseMetaData, ResultSet getColumns(String, String, String, String)Only privileges matching the column name criteria are returned. They are ordered by COLUMN_NAME and PRIVILEGE.
Each privilige description has the following columns:
@param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schema a schema name; "" retrieves those without a schema @param table a table name @param columnNamePattern a column name pattern @return
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- COLUMN_NAME String => column name
- GRANTOR => grantor of access (may be null)
- GRANTEE String => grantee of access
- PRIVILEGE String => name of access (SELECT INSERT UPDATE REFRENCES ...)
- IS_GRANTABLE String => "YES" if grantee is permitted to grant to others; "NO" if not; null if unknown
ResultSet
- each row is a column privilege description @exception SQLException if a database access error occurs @see #getSearchStringEscape
Gets a description of table columns available in the specified catalog.Class DatabaseMetaData, Connection getConnection()Only column descriptions matching the catalog schema table and column name criteria are returned. They are ordered by TABLE_SCHEM TABLE_NAME and ORDINAL_POSITION.
Each column description has the following columns:
@param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schemaPattern a schema name pattern; "" retrieves those without a schema @param tableNamePattern a table name pattern @param columnNamePattern a column name pattern @return
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- COLUMN_NAME String => column name
- DATA_TYPE short => SQL type from java.sql.Types
- TYPE_NAME String => Data source dependent type name for a UDT the type name is fully qualified
- COLUMN_SIZE int => column size. For char or date types this is the maximum number of characters for numeric or decimal types this is precision.
- BUFFER_LENGTH is not used.
- DECIMAL_DIGITS int => the number of fractional digits
- NUM_PREC_RADIX int => Radix (typically either 10 or 2)
- NULLABLE int => is NULL allowed
- columnNoNulls - might not allow NULL values
- columnNullable - definitely allows NULL values
- columnNullableUnknown - nullability unknown
- REMARKS String => comment describing column (may be null)
- COLUMN_DEF String => default value (may be null)
- SQL_DATA_TYPE int => unused
- SQL_DATETIME_SUB int => unused
- CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
- ORDINAL_POSITION int => index of column in table (starting at 1)
- IS_NULLABLE String => "NO" means column definitely does not allow NULL values; "YES" means the column might allow NULL values. An empty string means nobody knows.
ResultSet
- each row is a column description @exception SQLException if a database access error occurs @see #getSearchStringEscape
Class DatabaseMetaData, ResultSet getCrossReference(String, String, String, String, String, String)JDBC 2.0Retrieves the connection that produced this metadata object. @return the connection that produced this metadata object @since 1.2 @see What Is in the JDBC 2.0 API
Gets a description of the foreign key columns in the foreign key table that reference the primary key columns of the primary key table (describe how one table imports another's key.) This should normally return a single foreign key/primary key pair (most tables only import a foreign key from a table once.) They are ordered by FKTABLE_CAT FKTABLE_SCHEM FKTABLE_NAME and KEY_SEQ.Class DatabaseMetaData, ResultSet getExportedKeys(String, String, String)Each foreign key column description has the following columns:
@param primaryCatalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param primarySchema a schema name; "" retrieves those without a schema @param primaryTable the table name that exports the key @param foreignCatalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param foreignSchema a schema name; "" retrieves those without a schema @param foreignTable the table name that imports the key @return
- PKTABLE_CAT String => primary key table catalog (may be null)
- PKTABLE_SCHEM String => primary key table schema (may be null)
- PKTABLE_NAME String => primary key table name
- PKCOLUMN_NAME String => primary key column name
- FKTABLE_CAT String => foreign key table catalog (may be null) being exported (may be null)
- FKTABLE_SCHEM String => foreign key table schema (may be null) being exported (may be null)
- FKTABLE_NAME String => foreign key table name being exported
- FKCOLUMN_NAME String => foreign key column name being exported
- KEY_SEQ short => sequence number within foreign key
- UPDATE_RULE short => What happens to foreign key when primary is updated:
- importedNoAction - do not allow update of primary key if it has been imported
- importedKeyCascade - change imported key to agree with primary key update
- importedKeySetNull - change imported key to NULL if its primary key has been updated
- importedKeySetDefault - change imported key to default values if its primary key has been updated
- importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
- DELETE_RULE short => What happens to the foreign key when primary is deleted.
- importedKeyNoAction - do not allow delete of primary key if it has been imported
- importedKeyCascade - delete rows that import a deleted key
- importedKeySetNull - change imported key to NULL if its primary key has been deleted
- importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
- importedKeySetDefault - change imported key to default if its primary key has been deleted
- FK_NAME String => foreign key name (may be null)
- PK_NAME String => primary key name (may be null)
- DEFERRABILITY short => can the evaluation of foreign key constraints be deferred until commit
- importedKeyInitiallyDeferred - see SQL92 for definition
- importedKeyInitiallyImmediate - see SQL92 for definition
- importedKeyNotDeferrable - see SQL92 for definition
ResultSet
- each row is a foreign key column description @exception SQLException if a database access error occurs @see #getImportedKeys
Gets a description of the foreign key columns that reference a table's primary key columns (the foreign keys exported by a table). They are ordered by FKTABLE_CAT FKTABLE_SCHEM FKTABLE_NAME and KEY_SEQ.Class DatabaseMetaData, ResultSet getImportedKeys(String, String, String)Each foreign key column description has the following columns:
@param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schema a schema name; "" retrieves those without a schema @param table a table name @return
- PKTABLE_CAT String => primary key table catalog (may be null)
- PKTABLE_SCHEM String => primary key table schema (may be null)
- PKTABLE_NAME String => primary key table name
- PKCOLUMN_NAME String => primary key column name
- FKTABLE_CAT String => foreign key table catalog (may be null) being exported (may be null)
- FKTABLE_SCHEM String => foreign key table schema (may be null) being exported (may be null)
- FKTABLE_NAME String => foreign key table name being exported
- FKCOLUMN_NAME String => foreign key column name being exported
- KEY_SEQ short => sequence number within foreign key
- UPDATE_RULE short => What happens to foreign key when primary is updated:
- importedNoAction - do not allow update of primary key if it has been imported
- importedKeyCascade - change imported key to agree with primary key update
- importedKeySetNull - change imported key to NULL if its primary key has been updated
- importedKeySetDefault - change imported key to default values if its primary key has been updated
- importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
- DELETE_RULE short => What happens to the foreign key when primary is deleted.
- importedKeyNoAction - do not allow delete of primary key if it has been imported
- importedKeyCascade - delete rows that import a deleted key
- importedKeySetNull - change imported key to NULL if its primary key has been deleted
- importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
- importedKeySetDefault - change imported key to default if its primary key has been deleted
- FK_NAME String => foreign key name (may be null)
- PK_NAME String => primary key name (may be null)
- DEFERRABILITY short => can the evaluation of foreign key constraints be deferred until commit
- importedKeyInitiallyDeferred - see SQL92 for definition
- importedKeyInitiallyImmediate - see SQL92 for definition
- importedKeyNotDeferrable - see SQL92 for definition
ResultSet
- each row is a foreign key column description @exception SQLException if a database access error occurs @see #getImportedKeys
Gets a description of the primary key columns that are referenced by a table's foreign key columns (the primary keys imported by a table). They are ordered by PKTABLE_CAT PKTABLE_SCHEM PKTABLE_NAME and KEY_SEQ.Class DatabaseMetaData, ResultSet getIndexInfo(String, String, String, boolean, boolean)Each primary key column description has the following columns:
@param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schema a schema name; "" retrieves those without a schema @param table a table name @return
- PKTABLE_CAT String => primary key table catalog being imported (may be null)
- PKTABLE_SCHEM String => primary key table schema being imported (may be null)
- PKTABLE_NAME String => primary key table name being imported
- PKCOLUMN_NAME String => primary key column name being imported
- FKTABLE_CAT String => foreign key table catalog (may be null)
- FKTABLE_SCHEM String => foreign key table schema (may be null)
- FKTABLE_NAME String => foreign key table name
- FKCOLUMN_NAME String => foreign key column name
- KEY_SEQ short => sequence number within foreign key
- UPDATE_RULE short => What happens to foreign key when primary is updated:
- importedNoAction - do not allow update of primary key if it has been imported
- importedKeyCascade - change imported key to agree with primary key update
- importedKeySetNull - change imported key to NULL if its primary key has been updated
- importedKeySetDefault - change imported key to default values if its primary key has been updated
- importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
- DELETE_RULE short => What happens to the foreign key when primary is deleted.
- importedKeyNoAction - do not allow delete of primary key if it has been imported
- importedKeyCascade - delete rows that import a deleted key
- importedKeySetNull - change imported key to NULL if its primary key has been deleted
- importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
- importedKeySetDefault - change imported key to default if its primary key has been deleted
- FK_NAME String => foreign key name (may be null)
- PK_NAME String => primary key name (may be null)
- DEFERRABILITY short => can the evaluation of foreign key constraints be deferred until commit
- importedKeyInitiallyDeferred - see SQL92 for definition
- importedKeyInitiallyImmediate - see SQL92 for definition
- importedKeyNotDeferrable - see SQL92 for definition
ResultSet
- each row is a primary key column description @exception SQLException if a database access error occurs @see #getExportedKeys
Gets a description of a table's indices and statistics. They are ordered by NON_UNIQUE TYPE INDEX_NAME and ORDINAL_POSITION.Class DatabaseMetaData, int getMaxIndexLength()Each index column description has the following columns:
@param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schema a schema name; "" retrieves those without a schema @param table a table name @param unique when true return only indices for unique values; when false return indices regardless of whether unique or not @param approximate when true result is allowed to reflect approximate or out of data values; when false results are requested to be accurate @return
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- NON_UNIQUE boolean => Can index values be non-unique false when TYPE is tableIndexStatistic
- INDEX_QUALIFIER String => index catalog (may be null); null when TYPE is tableIndexStatistic
- INDEX_NAME String => index name; null when TYPE is tableIndexStatistic
- TYPE short => index type:
- tableIndexStatistic - this identifies table statistics that are returned in conjuction with a table's index descriptions
- tableIndexClustered - this is a clustered index
- tableIndexHashed - this is a hashed index
- tableIndexOther - this is some other style of index
- ORDINAL_POSITION short => column sequence number within index; zero when TYPE is tableIndexStatistic
- COLUMN_NAME String => column name; null when TYPE is tableIndexStatistic
- ASC_OR_DESC String => column sort sequence "A" => ascending "D" => descending may be null if sort sequence is not supported; null when TYPE is tableIndexStatistic
- CARDINALITY int => When TYPE is tableIndexStatistic then this is the number of rows in the table; otherwise it is the number of unique values in the index.
- PAGES int => When TYPE is tableIndexStatisic then this is the number of pages used for the table otherwise it is the number of pages used for the current index.
- FILTER_CONDITION String => Filter condition if any. (may be null)
ResultSet
- each row is an index column description @exception SQLException if a database access error occurs
Class DatabaseMetaData, int getMaxStatementLength()What'sRetrieves the maximumlengthnumber of bytes for an index(inincludingbytes)all of the parts of the index. @return max index length in bytes which includes the composite of all the constituent parts of the index; a result of zero means that there is no limit or the limit is not known @exception SQLException if a database access error occurs
What's the maximum length ofClass DatabaseMetaData, ResultSet getPrimaryKeys(String, String, String)aan SQL statement @return max length in bytes; a result of zero means that there is no limit or the limit is not known @exception SQLException if a database access error occurs
Gets a description of a table's primary key columns. They are ordered by COLUMN_NAME.Class DatabaseMetaData, ResultSet getProcedureColumns(String, String, String, String)Each primary key column description has the following columns:
@param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schema a schema name; "" retrieves those without a schema @param table a table name @return
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- COLUMN_NAME String => column name
- KEY_SEQ short => sequence number within primary key
- PK_NAME String => primary key name (may be null)
ResultSet
- each row is a primary key column description @exception SQLException if a database access error occurs
Gets a description of a catalog's stored procedure parameters and result columns.Class DatabaseMetaData, ResultSet getProcedures(String, String, String)Only descriptions matching the schema procedure and parameter name criteria are returned. They are ordered by PROCEDURE_SCHEM and PROCEDURE_NAME. Within this the return value if any is first. Next are the parameter descriptions in call order. The column descriptions follow in column number order.
Each row in the
ResultSet
is a parameter description or column description with the following fields:
- PROCEDURE_CAT String => procedure catalog (may be null)
- PROCEDURE_SCHEM String => procedure schema (may be null)
- PROCEDURE_NAME String => procedure name
- COLUMN_NAME String => column/parameter name
- COLUMN_TYPE Short => kind of column/parameter:
- procedureColumnUnknown - nobody knows
- procedureColumnIn - IN parameter
- procedureColumnInOut - INOUT parameter
- procedureColumnOut - OUT parameter
- procedureColumnReturn - procedure return value
- procedureColumnResult - result column in
ResultSet
- DATA_TYPE short => SQL type from java.sql.Types
- TYPE_NAME String => SQL type name for a UDT type the type name is fully qualified
- PRECISION int => precision
- LENGTH int => length in bytes of data
- SCALE short => scale
- RADIX short => radix
- NULLABLE short => can it contain NULL
- procedureNoNulls - does not allow NULL values
- procedureNullable - allows NULL values
- procedureNullableUnknown - nullability unknown
- REMARKS String => comment describing parameter/column
Note: Some databases may not return the column descriptions for a procedure. Additional columns beyond REMARKS can be defined by the database. @param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schemaPattern a schema name pattern; "" retrieves those without a schema @param procedureNamePattern a procedure name pattern @param columnNamePattern a column name pattern @return
ResultSet
- each row describes a stored procedure parameter or column @exception SQLException if a database access error occurs @see #getSearchStringEscape
Gets a description of the stored procedures available in a catalog.Class DatabaseMetaData, ResultSet getSchemas()Only procedure descriptions matching the schema and procedure name criteria are returned. They are ordered by PROCEDURE_SCHEM and PROCEDURE_NAME.
Each procedure description has the the following columns:
@param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schemaPattern a schema name pattern; "" retrieves those without a schema @param procedureNamePattern a procedure name pattern @return
- PROCEDURE_CAT String => procedure catalog (may be null)
- PROCEDURE_SCHEM String => procedure schema (may be null)
- PROCEDURE_NAME String => procedure name
- reserved for future use
- reserved for future use
- reserved for future use
- REMARKS String => explanatory comment on the procedure
- PROCEDURE_TYPE short => kind of procedure:
- procedureResultUnknown - May return a result
- procedureNoResult - Does not return a result
- procedureReturnsResult - Returns a result
ResultSet
- each row is a procedure description @exception SQLException if a database access error occurs @see #getSearchStringEscape
Gets the schema names available in this database. The results are ordered by schema name.Class DatabaseMetaData, ResultSet getTablePrivileges(String, String, String)The schema column is:
@return
- TABLE_SCHEM String => schema name
ResultSet
- each row has a single String column that is a schema name @exception SQLException if a database access error occurs
Gets a description of the access rights for each table available in a catalog. Note that a table privilege applies to one or more columns in the table. It would be wrong to assume that this priviledge applies to all columns (this may be true for some systems but is not true for all.)Class DatabaseMetaData, ResultSet getTableTypes()Only privileges matching the schema and table name criteria are returned. They are ordered by TABLE_SCHEM TABLE_NAME and PRIVILEGE.
Each privilige description has the following columns:
@param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schemaPattern a schema name pattern; "" retrieves those without a schema @param tableNamePattern a table name pattern @return
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- GRANTOR => grantor of access (may be null)
- GRANTEE String => grantee of access
- PRIVILEGE String => name of access (SELECT INSERT UPDATE REFRENCES ...)
- IS_GRANTABLE String => "YES" if grantee is permitted to grant to others; "NO" if not; null if unknown
ResultSet
- each row is a table privilege description @exception SQLException if a database access error occurs @see #getSearchStringEscape
Gets the table types available in this database. The results are ordered by table type.Class DatabaseMetaData, ResultSet getTables(String, String, String, String[])The table type is:
@return
- TABLE_TYPE String => table type. Typical types are "TABLE" "VIEW" "SYSTEM TABLE" "GLOBAL TEMPORARY" "LOCAL TEMPORARY" "ALIAS" "SYNONYM".
ResultSet
- each row has a single String column that is a table type @exception SQLException if a database access error occurs
Gets a description of tables available in a catalog.Class DatabaseMetaData, ResultSet getTypeInfo()Only table descriptions matching the catalog schema table name and type criteria are returned. They are ordered by TABLE_TYPE TABLE_SCHEM and TABLE_NAME.
Each table description has the following columns:
- TABLE_CAT String => table catalog (may be null)
- TABLE_SCHEM String => table schema (may be null)
- TABLE_NAME String => table name
- TABLE_TYPE String => table type. Typical types are "TABLE" "VIEW" "SYSTEM TABLE" "GLOBAL TEMPORARY" "LOCAL TEMPORARY" "ALIAS" "SYNONYM".
- REMARKS String => explanatory comment on the table
Note: Some databases may not return information for all tables. @param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schemaPattern a schema name pattern; "" retrieves those without a schema @param tableNamePattern a table name pattern @param types a list of table types to include; null returns all types @return
ResultSet
- each row is a table description @exception SQLException if a database access error occurs @see #getSearchStringEscape
Gets a description of all the standard SQL types supported by this database. They are ordered by DATA_TYPE and then by how closely the data type maps to the corresponding JDBC SQL type.Class DatabaseMetaData, ResultSet getUDTs(String, String, String, int[])Each type description has the following columns:
@return
- TYPE_NAME String => Type name
- DATA_TYPE short => SQL data type from java.sql.Types
- PRECISION int => maximum precision
- LITERAL_PREFIX String => prefix used to quote a literal (may be null)
- LITERAL_SUFFIX String => suffix used to quote a literal (may be null)
- CREATE_PARAMS String => parameters used in creating the type (may be null)
- NULLABLE short => can you use NULL for this type
- typeNoNulls - does not allow NULL values
- typeNullable - allows NULL values
- typeNullableUnknown - nullability unknown
- CASE_SENSITIVE boolean=> is it case sensitive
- SEARCHABLE short => can you use "WHERE" based on this type:
- typePredNone - No support
- typePredChar - Only supported with WHERE .. LIKE
- typePredBasic - Supported except for WHERE .. LIKE
- typeSearchable - Supported for all WHERE ..
- UNSIGNED_ATTRIBUTE boolean => is it unsigned
- FIXED_PREC_SCALE boolean => can it be a money value
- AUTO_INCREMENT boolean => can it be used for an auto-increment value
- LOCAL_TYPE_NAME String => localized version of type name (may be null)
- MINIMUM_SCALE short => minimum scale supported
- MAXIMUM_SCALE short => maximum scale supported
- SQL_DATA_TYPE int => unused
- SQL_DATETIME_SUB int => unused
- NUM_PREC_RADIX int => usually 2 or 10
ResultSet
- each row isaan SQL type description @exception SQLException if a database access error occurs
Class DatabaseMetaData, ResultSet getVersionColumns(String, String, String)JDBC 2.0Gets a description of the user-defined types defined in a particular schema. Schema-specific UDTs may have type JAVA_OBJECT STRUCT or DISTINCT.Only types matching the catalog schema type name and type criteria are returned. They are ordered by DATA_TYPE TYPE_SCHEM and TYPE_NAME. The type name parameter may be a fully-qualified name. In this case the catalog and schemaPattern parameters are ignored.
Each type description has the following columns:
- TYPE_CAT String => the type's catalog (may be null)
- TYPE_SCHEM String => type's schema (may be null)
- TYPE_NAME String => type name
- CLASS_NAME String => Java class name
- DATA_TYPE String => type value defined in java.sql.Types. One of JAVA_OBJECT STRUCT or DISTINCT
- REMARKS String => explanatory comment on the type
Note: If the driver does not support UDTs an empty result set is returned. @param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schemaPattern a schema name pattern; "" retrieves those without a schema @param typeNamePattern a type name pattern; may be a fully-qualified name @param types a list of user-named types to include (JAVA_OBJECT STRUCT or DISTINCT); null returns all types @return
ResultSet
- each row is a type description @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets a description of a table's columns that are automatically updated when any value in a row is updated. They are unordered.Class DatabaseMetaData, boolean insertsAreDetected(int)Each column description has the following columns:
@param catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria @param schema a schema name; "" retrieves those without a schema @param table a table name @return
- SCOPE short => is not used
- COLUMN_NAME String => column name
- DATA_TYPE short => SQL data type from java.sql.Types
- TYPE_NAME String => Data source dependent type name
- COLUMN_SIZE int => precision
- BUFFER_LENGTH int => length of column value in bytes
- DECIMAL_DIGITS short => scale
- PSEUDO_COLUMN short => is this a pseudo column like an Oracle ROWID
- versionColumnUnknown - may or may not be pseudo column
- versionColumnNotPseudo - is NOT a pseudo column
- versionColumnPseudo - is a pseudo column
ResultSet
- each row is a column description @exception SQLException if a database access error occurs
Class DatabaseMetaData, boolean nullPlusNonNullIsNull()JDBC 2.0Indicates whether or not a visible row insert can be detected by calling ResultSet.rowInserted(). @param result set type i.e. ResultSet.TYPE_XXX @return true if changes are detected by the resultset type @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Are concatenations between NULL and non-NULL values NULLClass DatabaseMetaData, boolean othersDeletesAreVisible(int)AFor SQL-92 compliance a JDBCCompliantTMtechnology-enabled driveralways returnswill returntrue
. @returntrue
if so;false
otherwise @exception SQLException if a database access error occurs
Class DatabaseMetaData, boolean othersInsertsAreVisible(int)JDBC 2.0Indicates whether deletes made by others are visible. @param result set type i.e. ResultSet.TYPE_XXX @returntrue
if deletes made by others are visible for the result set type;false
otherwise @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class DatabaseMetaData, boolean othersUpdatesAreVisible(int)JDBC 2.0Indicates whether inserts made by others are visible. @param result set type i.e. ResultSet.TYPE_XXX @return true if updates are visible for the result set type @returntrue
if inserts made by others are visible for the result set type;false
otherwise @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class DatabaseMetaData, boolean ownDeletesAreVisible(int)JDBC 2.0Indicates whether updates made by others are visible. @param result set type i.e. ResultSet.TYPE_XXX @returntrue
if updates made by others are visible for the result set type;false
otherwise @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class DatabaseMetaData, boolean ownInsertsAreVisible(int)JDBC 2.0Indicates whether a result set's own deletes are visible. @param result set type i.e. ResultSet.TYPE_XXX @returntrue
if deletes are visible for the result set type;false
otherwise @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class DatabaseMetaData, boolean ownUpdatesAreVisible(int)JDBC 2.0Indicates whether a result set's own inserts are visible. @param result set type i.e. ResultSet.TYPE_XXX @returntrue
if inserts are visible for the result set type;false
otherwise @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class DatabaseMetaData, boolean supportsBatchUpdates()JDBC 2.0Indicates whether a result set's own updates are visible. @param result set type i.e. ResultSet.TYPE_XXX @returntrue
if updates are visible for the result set type;false
otherwise @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class DatabaseMetaData, boolean supportsMultipleResultSets()JDBC 2.0Indicates whether the driver supports batch updates. @return true if the driver supports batch updates; false otherwise @since 1.2 @see What Is in the JDBC 2.0 API
Are multipleClass DatabaseMetaData, boolean supportsResultSetConcurrency(int, int)ResultSetsResultSet
from a single execute supported @returntrue
if so;false
otherwise @exception SQLException if a database access error occurs
Class DatabaseMetaData, boolean supportsResultSetType(int)JDBC 2.0Does the database support the concurrency type in combination with the given result set type @param type defined injava.sql.ResultSet
@param concurrency type defined injava.sql.ResultSet
@returntrue
if so;false
otherwise @exception SQLException if a database access error occurs @see Connection @since 1.2 @see What Is in the JDBC 2.0 API
Class DatabaseMetaData, boolean updatesAreDetected(int)JDBC 2.0Does the database support the given result set type @param type defined injava.sql.ResultSet
@returntrue
if so;false
otherwise @exception SQLException if a database access error occurs @see Connection @since 1.2 @see What Is in the JDBC 2.0 API
JDBC 2.0Indicates whether or not a visible row update can be detected by calling the methodResultSet.rowUpdated
. @param result set type i.e. ResultSet.TYPE_XXX @returntrue
if changes are detected by the result set type;false
otherwise @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Formats a date inJDBCthe date escape format yyyy-mm-dd.NOTE: To specify a date format for the class
. For example:SimpleDateFormat
use "yyyy.MM.dd" rather than "yyyy-mm-dd". In the context ofSimpleDateFormat
"mm" indicates minutes rather than the monthFormat Pattern Result -------------- ------- "yyyy.MM.dd G 'at' hh:mm:ss z" ->> 1996.07.10 AD at 15:08:56 PDT@return a String in yyyy-mm-dd format
Class DriverManager, void deregisterDriver(Driver)The basic service for managing a set of JDBC drivers.
NOTE: TheDataSource
interface new in the JDBC 2.0 API provides another way to connect to a data source. The use of aDataSource
object is the preferred means of connecting to a data source.As part of its initialization the
DriverManager
class will attempt to load the driver classes referenced in the "jdbc.drivers" system property. This allows a user to customize the JDBC Drivers used by their applications. For example in your ~/.hotjava/properties file you might specify:A program can also explicitly load JDBC drivers at any time. For example the my.sql.Driver is loaded with the following statement:jdbc.drivers=foo.bah.Driver:wombat.sql.Driver:bad.taste.ourDriver
Class.forName("my.sql.Driver");
When the method
getConnection
is called theDriverManager
will attempt to locate a suitable driver from amongst those loaded at initialization and those loaded explicitly using the same classloader as the current applet or application.Starting with the Java 2 SDK Standard Edition version 1.3 a logging stream can be set only if the proper permission has been granted. Normally this will be done with the tool PolicyTool which can be used to grant
permission java.sql.SQLPermission "setLog"
. @see Driver @see ConnectionSome methods in this class are new in the JDBC 2.0 API. They are marked with "since 1.2". API marked "since 1.3" is new in the JDBC 2.0 API and is included in the Java 2 SDK Standard Edition version 1.3.
Drops a Driver from the DriverManager
's list. Applets can only deregister Drivers from their own classloaders. @param driver the JDBC Driver to drop @exception SQLException if a database access error occurs
Class DriverManager, Connection getConnection(String)Attempts to establish a connection to the given database URL. TheClass DriverManager, Connection getConnection(String, Properties)DriverManager
attempts to select an appropriate driver from the set of registered JDBC drivers. @param url a database url of the formjdbc:subprotocol:subname
@return aConnectionconnection to the URL @exception SQLException if a database access error occurs
Attempts to establish a connection to the given database URL. TheClass DriverManager, Connection getConnection(String, String, String)DriverManager
attempts to select an appropriate driver from the set of registered JDBC drivers. @param url a database url of the formjdbc:subprotocol:subname
@param info a list of arbitrary string tag/value pairs as connection arguments; normally at least a "user" and "password" property should be included @return a Connection to the URL @exception SQLException if a database access error occurs
Attempts to establish a connection to the given database URL. TheClass DriverManager, Driver getDriver(String)DriverManager
attempts to select an appropriate driver from the set of registered JDBC drivers. @param url a database url of the formjdbc:subprotocol:subname
@param user the database user on whose behalf theConnectionconnection is being made @param password the user's password @return aConnectionconnection to the URL @exception SQLException if a database access error occurs
Attempts to locate a driver that understands the given URL. TheClass DriverManager, PrintStream getLogStream()DriverManager
attempts to select an appropriate driver from the set of registered JDBC drivers. @param url a databaseurlURL of the formjdbc:subprotocol:subname
@return aDriver
object representing a driver that can connect to the given URL @exception SQLException if a database access error occurs
Gets the logging/tracing PrintStream that is used by theClass DriverManager, PrintWriter getLogWriter()DriverManager
and all drivers. @return the logging/tracing PrintStream; if disabled isnull
@deprecated
Class DriverManager, void registerDriver(Driver)JDBC 2.0Gets the log writer. ThegetLogWriter
andsetLogWriter
methods should be used instead of theoldget/setlogStream
methods which are deprecated. @return ajava.io.PrintWriter
object @see What Is in the JDBC 2.0 API @since 1.2
Registers the given driver with theClass DriverManager, void setLogStream(PrintStream)DriverManager
. A newly-loaded driver class should call the methodregisterDriver
to make itself known to theDriverManager
. @param driver the new JDBC Driver that is to be registered with theDriverManager
@exception SQLException if a database access error occurs
Sets the logging/tracing PrintStream that is used by theClass DriverManager, void setLogWriter(PrintWriter)DriverManager
and all drivers.In the Java 2 SDK Standard Edition version 1.3 release this method checks to see that there is an
SQLPermission
object before setting the logging stream. If aSecurityManager
exists and itscheckPermission
method denies setting the log writer this method throws ajava.lang.SecurityException
. @param out the new logging/tracing PrintStream; to disable set tonull
@deprecated @throws SecurityException if a security manager exists and itscheckPermission
method denies setting the log stream. @see SecurityManager#checkPermission
JDBC 2.0Sets the logging/tracingWriterPrintWriter
object that is used by theDriverManager
and all drivers.There is a minor versioning problem
introducedcreated by the introduction of the method setLogWriter. The methodsetLogWriter
cannot create aPrintStream
object that will be returned bygetLogStream
---the Java platform does not provide a backward conversion.SoAs a result a new application that usessetLogWriter
and also uses a JDBC 1.0 driver that usesgetLogStream
will likely not see debugging information written by that driver.In the Java 2 SDK Standard Edition version 1.3 release this method checks to see that there is an
SQLPermission
object before setting the logging stream. If aSecurityManager
exists and itscheckPermission
method denies setting the log writer this method throws ajava.lang.SecurityException
. @param out the new logging/tracingPrintStream
object;null
to disablesetlogging andtotracingnull@throws SecurityException if a security manager exists and itscheckPermission
method denies setting the log writer @see SecurityManager#checkPermission @see What Is in the JDBC 2.0 API @since 1.2
An object that represents a precompiled SQL statement.Class PreparedStatement, void addBatch()A SQL statement is
pre-compiledprecompiled and stored in aPreparedStatement
object. This object can then be used to efficiently execute this statement multiple times.Note: The setXXX methods for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For instance if the IN parameter has SQL type
Integer
then the methodsetInt
should be used.If arbitrary parameter type conversions are required the method
setObject
should be used with a target SQL type.
Example of setting a parameter;con
is an active connection@see Connection#prepareStatement @see ResultSetPreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = WHERE ID = "); pstmt.setBigDecimal(1 153833.00) pstmt.setInt(2 110592)
Some of the methods in this interface are new in the JDBC 2.0 API.
Class PreparedStatement, void clearParameters()JDBC 2.0Adds a set of parameters tothethisPreparedStatement
object's batch of commands. @exception SQLException if a database access error occurs @see Statement#addBatch @since 1.2 @see What Is in the JDBC 2.0 API
Clears the current parameter values immediately.Class PreparedStatement, boolean execute()In general parameter values remain in force for repeated use of a
Statementstatement. Setting a parameter value automatically clears its previous value. However in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling the methodclearParameters. @exception SQLException if a database access error occurs
Executes any kind of SQL statement. Some prepared statements return multiple results; theClass PreparedStatement, ResultSet executeQuery()execute
method handles these complex statements as well as the simpler form of statements handled by the methodsexecuteQuery and
executeUpdate
. @exception SQLException if a database access error occurs @see Statement#execute
Executes the SQL query in thisClass PreparedStatement, ResultSetMetaData getMetaData()PreparedStatement
object and returns the result set generated by the query. @return aResultSet
object that contains the data produced by the query; nevernull
@exception SQLException if a database access error occurs
Class PreparedStatement, void setArray(int, Array)JDBC 2.0Gets the number types and properties of aResultSet
object's columns. @return the description of aResultSet
object's columns @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class PreparedStatement, void setAsciiStream(int, InputStream, int)JDBCSets2the designated parameter to the givenArray
object.0Sets an Array parameter. @param i the first parameter is 1 the second is 2 ... @param x anArray
objectrepresentingthat maps an SQLarrayARRAY
value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
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 aClass PreparedStatement, void setBigDecimal(int, BigDecimal)LONGVARCHAR
parameter it may be more practical to send it via ajava.io.InputStream
.JDBCData willread thebedataread from the stream as needed untilit reachesend-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. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the Java input stream that contains the ASCII parameter value @param length the number of bytes in the stream @exception SQLException if a database access error occurs
Sets the designated parameter to aClass PreparedStatement, void setBinaryStream(int, InputStream, int)java.
value. The driver converts this to an SQLlangmath.BigDecimalNUMERIC
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
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 aClass PreparedStatement, void setBlob(int, Blob)LONGVARBINARY
parameter it may be more practical to send it via ajava.io.InputStream
object.JDBC will read the dataThe data will be read from the stream as needed untilit reachesend-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. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the java input stream which contains the binary parameter value @param length the number of bytes in the stream @exception SQLException if a database access error occurs
Class PreparedStatement, void setBoolean(int, boolean)JDBC 2.0Setsa BLOBthe designated parameter to the givenBlob
object. @param i the first parameter is 1 the second is 2 ... @param xanaBlob
objectrepresentingthatamaps an SQLBLOB value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Sets the designated parameter to a JavaClass PreparedStatement, void setByte(int, byte)boolean
value. The driver converts this to an SQLBIT
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Sets the designated parameter to a JavaClass PreparedStatement, void setBytes(int, byte[])byte
value. The driver converts this to an SQLTINYINT
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Sets the designated parameter to a Java array of bytes. The driver converts this to an SQLClass PreparedStatement, void setCharacterStream(int, Reader, int)VARBINARY
orLONGVARBINARY
(depending on the argument's size relative to the driver's limits onVARBINARYsVARBINARY
values) when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Class PreparedStatement, void setClob(int, Clob)JDBC 2.0Sets the designated parameter to the givenReader
object which is the given number of characters long. When a very large UNICODE value is input to aLONGVARCHAR
parameter it may be more practical to send it via ajava.io.Reader
object.JDBC will read the dataThe data will be read from the stream as needed untilit reachesend-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. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the java reader which contains the UNICODE data @param length the number of characters in the stream @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class PreparedStatement, void setDate(int, Date)JDBC 2.0Setsa CLOBthe designated parameter to the givenClob
object. @param i the first parameter is 1 the second is 2 ... @param xanaClob
objectrepresentingthatamaps an SQLCLOB value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Sets the designated parameter to aClass PreparedStatement, void setDate(int, Date, Calendar)java.sql.Datevalue. The driver converts this to an SQL
DATE
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Class PreparedStatement, void setDouble(int, double)JDBC 2.0Sets the designated parameter toathe givenjava.sql.Date
value using the givenCalendar
object. The driver uses theCalendar
object to construct an SQLDATE
value which the driver then sends to the database. With a aCalendar
object the driver can calculate the date taking into account a custom timezoneand locale. If noCalendar
object is specified the driver uses the default timezoneandwhich is that of the virtual machine running thelocaleapplication. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @param cal theCalendar
object the driver will use to construct the date @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Sets the designated parameter to a JavaClass PreparedStatement, void setFloat(int, float)double
value. The driver converts this to an SQLDOUBLE
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Sets the designated parameter to a JavaClass PreparedStatement, void setInt(int, int)float
value. The driver converts this to an SQLFLOAT
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Sets the designated parameter to a JavaClass PreparedStatement, void setLong(int, long)int
value. The driver converts this to an SQLINTEGER
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Sets the designated parameter to a JavaClass PreparedStatement, void setNull(int, int)long
value. The driver converts this to an SQLBIGINT
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Sets the designated parameter to SQLClass PreparedStatement, void setNull(int, int, String)NULL
.Note: You must specify the parameter's SQL type. @param parameterIndex the first parameter is 1 the second is 2 ... @param sqlType the SQL type code defined in
java.sql.Types
@exception SQLException if a database access error occurs
Class PreparedStatement, void setObject(int, Object)JDBC 2.0Sets the designated parameter to SQLNULL
. This version of the methodsetNull should be used for user-
nameddefined types and REF type parameters. Examples of user-nameddefined 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-
nameddefined 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-nameddefined 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-nameddefined or REF type the given typeName is ignored. @param parameterIndex the first parameter is 1 the second is 2 ... @param sqlType a value fromjava.sql.Types
@param typeName the fully-qualified name of an SQL user-nameddefined type; ignored if the parameter is not a user-nameddefined type or REF @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class PreparedStatement, void setObject(int, Object, int)Sets the value of
athe designated parameter usinganthe given object. The second parameter must be of typeObject
;usetherefore thejava.lang
equivalent objects should be used forintegralbuilt-invaluestypes.The JDBC specification specifies a standard mapping from Java
Object
types to SQL types. The given argumentjava objectwill be converted to the corresponding SQL type before being sent to the database.Note that this method may be used to pass datatabase- specific abstract data types by using a
Driverdriver-specific Java type. If the object is of a class implementing the interfaceSQLData the JDBC driver should call
itsthe methodSQLData.writeSQL
to write it to the SQL data stream. If on the other hand the object is of a class implementing Ref Blob Clob Struct or Array then 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 ofthosethe interfaces named above. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the object containing the input parameter value @exception SQLException if a database access error occurs
Sets the value of the designated parameter with the given object. This method is like the method
setObject above except that it assumes a scale of zero. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the object containing the input parameter value @param targetSqlType the SQL type (as defined in java.sql.Types) to be sent to the database @exception SQLException if a database access error occurs
Class PreparedStatement, void setObject(int, Object, int, int)Class PreparedStatement, void setRef(int, Ref)Sets the value of
athe designated parameterusing anwith the given object. The second argument must be an object type; for integral values thejava.lang
equivalent objects should be used.The given Java object will be converted to the given targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing the interface
SQLData) the JDBC driver should call
itsthe methodSQLData.writeSQL
to write it to the SQL data stream. If on the other hand the object is of a class implementing Ref Blob Clob Struct or Array 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 datatabase- specific abstract data types. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the object containing the input parameter value @param targetSqlType the SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type. @param 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. @exception SQLException if a database access error occurs @see Types
Class PreparedStatement, void setShort(int, short)JDBCSets2.0theSetsdesignatedaparameter to the givenREF(<structured-type>)
parametervalue. @param i the first parameter is 1 the second is 2 ... @param x anobject representing data of anSQLREF
Typevalue @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Sets the designated parameter to a JavaClass PreparedStatement, void setString(int, String)short
value. The driver converts this to an SQLSMALLINT
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Sets the designated parameter to a JavaClass PreparedStatement, void setTime(int, Time)String
value. The driver converts this to an SQLVARCHAR
orLONGVARCHAR
value (depending on the argument's size relative to the driver's limits onVARCHARsVARCHAR
values) when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Sets the designated parameter to aClass PreparedStatement, void setTime(int, Time, Calendar)java.sql.Time
value. The driver converts this to an SQLTIME
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Class PreparedStatement, void setTimestamp(int, Timestamp)JDBC 2.0Sets the designated parameter toathe givenjava.sql.Time
value using the givenCalendar
object. The driver uses theCalendar
object to construct an SQLTIME
value which the driver then sends to the database. With a aCalendar
object the driver can calculate the time taking into account a custom timezoneand locale. If noCalendar
object is specified the driver uses the default timezoneandwhich is that of the virtual machine running thelocaleapplication. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @param cal theCalendar
object the driver will use to construct the time @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Sets the designated parameter to aClass PreparedStatement, void setTimestamp(int, Timestamp, Calendar)java.sql.Timestamp
value. The driver converts this to an SQLTIMESTAMP
value when it sends it to the database. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @exception SQLException if a database access error occurs
Class PreparedStatement, void setUnicodeStream(int, InputStream, int)JDBC 2.0Sets the designated parameter toathe givenjava.sql.Timestamp
value using the givenCalendar
object. The driver uses theCalendar
object to construct an SQLTIMESTAMP
value which the driver then sends to the database. With a aCalendar
object the driver can calculate the timestamp taking into account a custom timezoneand locale. If noCalendar
object is specified the driver uses the default timezoneandwhich is that of the virtual machine running thelocaleapplication. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the parameter value @param cal theCalendar
object the driver will use to construct the timestamp @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Sets the designated parameter to the given input stream which will have the specified number of bytes. When a very large UNICODE value is input to aLONGVARCHAR
parameter it may be more practical to send it via ajava.io.InputStream
object.JDBC will read the dataThe data will be read from the stream as needed untilit reachesend-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format. The byte format of the Unicode stream must be Java UTF-8 as defined in the Java Virtual Machine Specification.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface. @param parameterIndex the first parameter is 1 the second is 2 ... @param x the java input stream which contains the UNICODE parameter value @param length the number of bytes in the stream @exception SQLException if a database access error occurs @deprecated
Class Ref, String getBaseTypeName()JDBCThe2.0mappingAin the Java programming language of an SQLREF
value which is a reference to an SQL structured type value in the database.SQL
REF
values are stored in a special table that contains instances of a referenceable SQL structured type and eachREF
value is a unique identifier for one instance in that table. An SQLREF
value may be used in place of the SQL structured type it references; it may be used as either a column value in a table or an attribute value in a structured type.Because an SQL
REF
value is a logical pointer to an SQL structured type aRef
object is by default also a logical pointer; thus retrieving an SQLREF
value as aRef
object does not materialize the attributes of the structured type on the client.A
Ref
object can be saved to persistent storage. ARefand is dereferenced by passing it as a parameter to an SQL statement and executing the statement.The
Ref
interface is new in the JDBC 2.0 API. @see Struct
GetsRetrieves the fully-qualified SQL name of the SQL structured typename ofthat thistheRef
referenced itemobject references. @return the fully-qualified SQLstructured typename of the referenceditem.SQL structured type @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
AClass ResultSet, boolean absolute(int)ResultSet provides access totable of data representing atable of data.databaseA ResultSet objectresult set which is usually generated by executing aStatementstatement that queries the database.A
ResultSet
object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The'next
method moves the cursor to the next row and because it returns'false
when there are no more rows in theResultSet
object it can be used in awhile
loop to iterate through the result set.A default
ResultSet
object is not updatable and has a cursor that moves forward only. Thus it is possible to iterate through it only once and only from the first row to the last row. New methods in the JDBC 2.0 API make it possible to produceResultSet
objects that are scrollable and/or updatable. The following code fragment in whichcon
is a validConnection
object illustrates how to make a result set that is scrollable and insensitive to updates by others and that is updatable. SeeResultSet
fields for other options.Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery("SELECT a b FROM TABLE2"); // rs will be scrollable will not show changes made by others // and will be updatableTheResultSet
interface providesgetXXX
methodsretrievefor retrieving column valuesforfrom the current row.YouValues canretrieve valuesbe retrieved using either the index number of the column or the name of the column. In general using the column index will be more efficient. Columns are numbered from 1. For maximum portabilityResultSetresult set columns within each row should be read in left-to-right order and each column should be read only once.For the
getXXX
methodsthea JDBC driver attempts to convert the underlying data to thespecifiedJava type specified in theXXX
part of thegetXXX
method and returns a suitable Java value.See theThe JDBC specificationforhas a table showing the allowable mappings from SQL types to Java types with theResultSet.getXXX
methods.Column names used as input to
getXXX
methods are case insensitive. WhenperformingagetXXX
usingmethod is called with a column nameifand several columns have the same namethenthe value of the first matching column will be returned. The column name option is designed to be used when column names are used in the SQL query that generated the result set. For columns that are NOT explicitly named in the query it is best to use column numbers. If column names are used there is no way for the programmer to guarantee that they actually refer to the intended columns.A set of
updateXXX
methods were added to this interface in the JDBC 2.0 API (JavaTM 2 SDK Standard Edition version 1.2). The comments regarding parameters to thegetXXX
methods also apply to parameters to theupdateXXX
methods.The
updateXXX
methods may be used in two ways:A
- to update a column value in the current row. In a scrollable
ResultSet
object the cursor can be moved backwards and forwards to an absolute position or to a position relative to the current row. The following code fragment updates theNAME
column in the fifth row of theResultSet
objectrs
and then uses the methodupdateRow
to update the data source table from whichrs
was derived.rs.absolute(5); // moves the cursor to the fifth row of rs rs.updateString("NAME" "AINSWORTH"); // updates the //NAME
column of row 5 to beAINSWORTH
rs.updateRow(); // updates the row in the data source- to insert column values into the insert row. An updatable
ResultSet
object has a special row associated with it that serves as a staging area for building a row to be inserted. The following code fragment moves the cursor to the insert row builds a three-column row and inserts it intors
and into the data source table using the methodinsertRow
.rs.moveToInsertRow(); // moves cursor to the insert row rs.updateString(1 "AINSWORTH"); // updates the // first column of the insert row to beAINSWORTH
rs.updateInt(2 35); // updates the second column to be35
rs.updateBoolean(3 true); // updates the third row totrue
rs.insertRow(); rs.moveToCurrentRow();ResultSet
object is automatically closedbywhen theStatement
object that generated itwhen that Statementis closed re-executed or used to retrieve the next result from a sequence of multiple results.The number types and properties of a
ResultSet
object's columns are provided by theResulSetMetaData
object returned by theResultSet.getMetaData
method. @see Statement#executeQuery @see Statement#getResultSet @see ResultSetMetaData
Class ResultSet, void afterLast()JDBC 2.0Moves the cursor to the given row number inthethisresultResultSet
setobject.If the row number is positive the cursor moves to the given row number with respect to the beginning of the result set. The first row is row 1 the second is row 2 and so on.
If the given row number is negative the cursor moves to an absolute row position with respect to the end of the result set. For example calling the method
absolute(-1)
positions the cursor on the last row; calling the methodabsolute(-2)
indicatesmoves the cursor to the next-to-last row and so on.An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before
/afterthe first/lastrowrespectivelyor after the last row.Note: Calling
absolute(1)
is the same as callingfirst()
. Callingabsolute(-1)
is the same as callinglast()
. @returntrue
if the cursor is on the result set;false
otherwise @exception SQLException if a database access error occursorthe row is0
or the result set type isTYPE_FORWARD_ONLY
@since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void beforeFirst()JDBC 2.0Moves the cursor to the end ofthethisresultResultSet
setobject just after the last row.HasThis method has no effect if the result set contains no rows. @exception SQLException if a database access error occurs or the result set type isTYPE_FORWARD_ONLY
@since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void cancelRowUpdates()JDBC 2.0Moves the cursor to the front ofthethisresultResultSet
setobject just before the first row.HasThis method has no effect if the result set contains no rows. @exception SQLException if a database access error occurs or the result set type isTYPE_FORWARD_ONLY
@since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void clearWarnings()JDBC 2.0Cancels the updates made toathe current row in thisResultSet
object. This method may be called after calling anupdateXXX
method(s) and before calling the methodupdateRow
torollbackroll back the updates made to a row. If no updates have been made orupdateRow
has already been calledthenthis method has no effect. @exception SQLException if a database access error occurs or if this method is called when the cursor is on the insert row @since 1.2 @see What Is in the JDBC 2.0 API
Clears all warnings reported on thisClass ResultSet, void close()ResultSet
object. After thiscallmethod is called the methodgetWarnings returns
null
until a new warning is reported for thisResultSet
object. @exception SQLException if a database access error occurs
Releases thisClass ResultSet, void deleteRow()ResultSet
object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.Note: A
ResultSet
object is automatically closed by theStatement
object that generated it when thatStatement
object is closed re-executed or is used to retrieve the next result from a sequence of multiple results. AResultSet
object is also automatically closed when it is garbage collected. @exception SQLException if a database access error occurs
Class ResultSet, int findColumn(String)JDBC 2.0Deletes the current row fromthethisresultResultSet
setobject and from the underlying database.CannotThis method cannot be called when the cursor is on the insert row. @exception SQLException if a database access error occurs or if this method is called when the cursor is on the insert row @since 1.2 @see What Is in the JDBC 2.0 API
Maps the givenClass ResultSet, boolean first()ResultsetResultSet
column name to itsResultSet
column index. @param columnName the name of the column @return the column index of the given column name @exception SQLException if a database access error occurs
Class ResultSet, Array getArray(String)JDBC 2.0Moves the cursor to the first row inthethisresultResultSet
setobject. @returntrue
if the cursor is on a valid row;false
if there are no rows in the result set @exception SQLException if a database access error occurs or the result set type isTYPE_FORWARD_ONLY
@since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, Array getArray(int)JDBCReturns2.0theGets an SQL ARRAY valuevalue of the designated column in the current row of thisResultSet
object as anArray
object in the Java programming language. @param colName the name of the column from which to retrieve the value @return anArray
object representing the SQLARRAY
value in the specified column @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, InputStream getAsciiStream(String)JDBCReturns2.0theGets an SQL ARRAY value fromvalue of the designated column in the current row of thisResultSet
object as anArray
object in the Java programming language. @param i the first column is 1 the second is 2 ... @return anArray
object representing the SQLARRAY
value in the specified column @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, InputStream getAsciiStream(int)athe designated column in the current row of thisResultSet
object as a stream of ASCII characters. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving largeLONGVARCHAR
values. The JDBC driver will do any necessary conversion from the database format into ASCII.Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a
getgetXXX
method implicitly closes the stream. Also a stream may return0
when the methodavailable
is called whether there is data available or not. @param columnName the SQL name of the column @return a Java input stream that delivers the database column value as a stream of one-byte ASCII characters. If the value is SQLNULL
thethenresultvalue returned isnull
. @exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, BigDecimal getBigDecimal(String)athe designated column in the current row of thisResultSet
object as a stream of ASCII characters. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving largeLONGVARCHAR values. The JDBC driver will do any necessary conversion from the database format into ASCII.Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a
getgetXXX
method implicitly closes the stream. Also a stream may return0
when the methodInputStream.available
is called whether there is data available or not. @param columnIndex the first column is 1 the second is 2 ... @return a Java input stream that delivers the database column value as a stream of one-byte ASCII characters.;Ifif the value is SQLNULL
thethenresultvalue returned isnull
@exception SQLException if a database access error occurs.
Class ResultSet, BigDecimal getBigDecimal(String, int)JDBC 2.0Gets the value ofathe designated column in the current row of thisResultSet
object as ajava.math.BigDecimal
objectwith full precision. @param columnName the column name @return the column value (full precision); if the value is SQLNULL
theresultvalue returned isnull
in the Java programming language. @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, BigDecimal getBigDecimal(int)athe designated column in the current row of thisResultSet
object as ajava.math.BigDecimal
objectin the Java programming language. @param columnName the SQL name of the column @param scale the number of digits to the right of the decimal point @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs @deprecated
Class ResultSet, BigDecimal getBigDecimal(int, int)JDBC 2.0Gets the value ofathe designated column in the current row of thisResultSet
object as ajava.math.BigDecimal
objectwith full precision. @param columnIndex the first column is 1 the second is 2 ... @return the column value (full precision); if the value is SQLNULL
theresultvalue returned isnull
in the Java programming language. @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, InputStream getBinaryStream(String)athe designated column in the current row of thisResultSet
object as ajava.
mathsql.BigDecimalobjectin the Java programming language. @param columnIndex the first column is 1 the second is 2 ... @param scale the number of digits to the right of the decimal point @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs @deprecated
Gets the value ofClass ResultSet, InputStream getBinaryStream(int)athe designated column in the current row of thisResultSet
object as a stream of uninterpretedbytesbyte
s. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving largeLONGVARBINARY
values.The JDBC driver will do any necessary conversion from the database format into uninterpreted bytes.Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a
getgetXXX
method implicitly closes the stream. Also a stream may return0
when the methodavailable
is called whether there is data available or not. @param columnName the SQL name of the column @return a Java input stream that delivers the database column value as a stream of uninterpreted bytes. If; if the value is SQLNULL
the result isthennull
@exception SQLException if a database access error occurs.
Gets the value of a column in the current row as a stream of Gets the value of the designated column in the current row of thisClass ResultSet, Blob getBlob(String)ResultSet
object as a binary stream of uninterpreted bytes. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving largeLONGVARBINARY
values.Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a
getgetXXX
method implicitly closes the stream. Also a stream may return0
when the methodInputStream.available
is called whether there is data available or not. @param columnIndex the first column is 1 the second is 2 ... @return a Java input stream that delivers the database column value as a stream of uninterpreted bytes. If; if the value is SQLNULL
thethenresultvalue returned isnull
@exception SQLException if a database access error occurs.
Class ResultSet, Blob getBlob(int)JDBCReturns2.0theGets a BLOBvalue of thevaluedesignated column in the current row of thisResultSet
object as aBlob
object in the Java programming language. @param colName the name of the column from which to retrieve the value @return aBlob
object representing the SQLBLOB
value in the specified column @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean getBoolean(String)JDBCReturns2.0theGets a BLOBvalue of thevaluedesignated column in the current row of thisResultSet
object as aBlob
object in the Java programming language. @param i the first column is 1 the second is 2 ... @return aBlob
object representing the SQLBLOB
value in the specified column @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, boolean getBoolean(int)athe designated column in the current row of thisResultSet
object as aboolean
in the Javabooleanprogramming language. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned isfalse
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, byte getByte(String)athe designated column in the current row of thisResultSet
object as aboolean
in the Javabooleanprogramming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned isfalse
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, byte getByte(int)athe designated column in the current row of thisResultSet
object as abyte
in the Javabyteprogramming language. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, byte[] getBytes(String)athe designated column in the current row of thisResultSet
object as abyte
in the Javabyteprogramming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, byte[] getBytes(int)athe designated column in the current row of thisResultSet
object as aJavabyte
array in the Java programming language. The bytes represent the raw values returned by the driver. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, Reader getCharacterStream(String)athe designated column in the current row of thisResultSet
object as aJavabyte
array in the Java programming language. The bytes represent the raw values returned by the driver. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs
Class ResultSet, Reader getCharacterStream(int)JDBC 2.0Gets the value ofathe designated column in the current row of thisResultSet
object as ajava.io.Reader
object. @return ajava.io.Reader
object that contains the column value; if the value is SQLNULL
the value returned isnull
in the Java programming language. @param columnName the name of the column @return the value in the specified column as ajava.io.Reader
@since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, Clob getClob(String)JDBC 2.0Gets the value ofathe designated column in the current row of thisResultSet
object as ajava.io.Reader
object. @return ajava.io.Reader
object that contains the column value; if the value is SQLNULL
the value returned isnull
in the Java programming language. @param columnIndex the first column is 1 the second is 2 ... @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, Clob getClob(int)JDBCReturns2.0theGets a CLOBvalue of thevaluedesignated column in the current row of thisResultSet
object as aClob
object in the Java programming language. @param colName the name of the column from which to retrieve the value @return aClob
object representing the SQLCLOB
value in the specified column @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, int getConcurrency()JDBCReturns2.0theGets a CLOBvalue of thevaluedesignated column in the current row of thisResultSet
object as aClob
object in the Java programming language. @param i the first column is 1 the second is 2 ... @return aClob
object representing the SQLCLOB
value in the specified column @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, String getCursorName()JDBC 2.0Returns the concurrency mode of thisresultResultSet
setobject. The concurrency used is determined by thestatementStatement
object that created the result set. @return the concurrency type eitherCONCUR_READ_ONLY or
CONCUR_UPDATABLE
@exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the name of the SQL cursor used by thisClass ResultSet, Date getDate(String)ResultSet
object.In SQL a result table is retrieved through a cursor that is named. The current row of a result set can be updated or deleted using a positioned update/delete statement that references the cursor name. To insure that the cursor has the proper isolation level to support update the cursor's
select
statement should be of the form 'select for update'. If the 'for update' clause is omitted the positioned updates may fail.The JDBC API supports this SQL feature by providing the name of the SQL cursor used by a
ResultSet
object. The current row of aResultSet
object is also the current row of this SQL cursor.Note: If positioned update is not supported a
SQLException
is thrown. @return the SQL name for thisResultSet object's
SQLcursorname@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, Date getDate(String, Calendar)athe designated column in the current row of thisResultSet
object as ajava.sql.Date
object in the Java programming language. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs
Class ResultSet, Date getDate(int)GetsReturns the value ofathe designated column in the current row of thisResultSet
object as ajava.sql.Date
object in the Java programming language. This method uses the given calendar to construct an appropriate millisecond value for theDatedate if the underlying database does not store timezone information. @param columnName the SQL name of the column from which to retrieve the value @param cal thecalendarjava.util.Calendar
object to use in constructing the date @return the column value as ajava.sql.Date
object; if the value is SQLNULL
theresultvalue returned isnull
in the Java programming language @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, Date getDate(int, Calendar)athe designated column in the current row of thisResultSet
object as ajava.sql.Date
object in the Java programming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs
Class ResultSet, double getDouble(String)JDBC 2.0ReturnsGetsthe value ofathe designated column in the current row of thisResultSet
object as ajava.sql.Date
object in the Java programming language. This method uses the given calendar to construct an appropriate millisecond value for theDatedate if the underlying database does not store timezone information. @param columnIndex the first column is 1 the second is 2 ... @param cal thecalendarjava.util.Calendar
object to use in constructing the date @return the column value as ajava.sql.Date
object; if the value is SQLNULL
theresultvalue returned isnull
in the Java programming language @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, double getDouble(int)athe designated column in the current row of thisResultSet
object as adouble
in the Javadoubleprogramming language. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, int getFetchDirection()athe designated column in the current row of thisResultSet
object as adouble
in the Javadoubleprogramming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Class ResultSet, int getFetchSize()JDBC 2.0Returns the fetch direction for thisresultResultSet
setobject. @return the current fetch direction for thisresultResultSet
setobject @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, float getFloat(String)JDBC 2.0Returns the fetch size for thisresultResultSet
setobject. @return the current fetch size for thisresultResultSet
setobject @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, float getFloat(int)athe designated column in the current row of thisResultSet
object as afloat
in the Javafloatprogramming language. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, int getInt(String)athe designated column in the current row of thisResultSet
object as afloat
in the Javafloatprogramming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, int getInt(int)athe designated column in the current row of thisResultSet
object asaanint
in the Javaintprogramming language. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, long getLong(String)athe designated column in the current row of thisResultSet
object asaanint
in the Javaintprogramming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, long getLong(int)athe designated column in the current row of thisResultSet
object as along
in the Javalongprogramming language. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, ResultSetMetaData getMetaData()athe designated column in the current row of thisResultSet
object as along
in the Javalongprogramming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Retrieves the number types and properties ofClass ResultSet, Object getObject(String)athisResultSet
object's columns. @return the description ofathisResultSet
object's columns @exception SQLException if a database access error occurs
Class ResultSet, Object getObject(String, Map)Gets the value of
athe designated column in the current row of thisResultSet
object asaanObject
in the Javaobjectprogramming language.This method will return the value of the given column as a Java object. The type of the Java object will be the default Java object type corresponding to the column's SQL type following the mapping for built-in types specified in the JDBC
specspecification.This method may also be used to read datatabase-specific abstract data types.
JDBC 2.0In the JDBC 2.0 API the behavior of the methodgetObject
is extended to materialize data of SQL user-defined types. Whenthea column contains a structured or distinct value the behavior of this method is as if it were a call to:getObject(columnIndex this.getStatement().getConnection().getTypeMap())
. @param columnName the SQL name of the column @return ajava.lang.Object
holding the column value.@exception SQLException if a database access error occurs
Class ResultSet, Object getObject(int)JDBC 2.0Returns the valueinof thespecifieddesignated column in the current row of thisResultSet
object asaanObject
in the Javaobjectprogramming language. This method uses the specifiedMap
object for custom mapping if appropriate. @param colName the name of the column from which to retrieve the value @param map ajava.util.Map
object that contains the mapping from SQL type names to classes in the Javaclassesprogramming language @return anobjectObject
representing the SQL value in the specified column @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, Object getObject(int, Map)Gets the value of
athe designated column in the current row of thisResultSet
object asaanObject
in the Javaobjectprogramming language.This method will return the value of the given column as a Java object. The type of the Java object will be the default Java object type corresponding to the column's SQL type following the mapping for built-in types specified in the JDBC
specspecification.This method may also be used to read datatabase-specific abstract data types.
JDBC 2.0In the JDBC 2.0 API the behavior of methodgetObject
is extended to materialize data of SQL user-defined types. Whenthea column contains a structured or distinct value the behavior of this method is as if it were a call to:getObject(columnIndex this.getStatement().getConnection().getTypeMap())
. @param columnIndex the first column is 1 the second is 2 ... @return ajava.lang.Object
holding the column value @exception SQLException if a database access error occurs
Class ResultSet, Ref getRef(String)JDBC 2.0Returns the value ofathe designated column in the current row of thisResultSet
object asaanObject
in the Javaobjectprogramming language. This method uses the givenMap
object for the custom mapping of the SQL structured or distinct type that is being retrieved. @param i the first column is 1 the second is 2 ... @param map ajava.util.Map
object that contains the mapping from SQL type names to classes in the Javaclassesprogramming language @return anobjectObject
in the Java programming language representing the SQL value @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, Ref getRef(int)JDBCReturns2.0theGets avalue ofREF(<structured-type>)thecolumn value fromdesignated column in the current row of thisResultSet
object as aRef
object in the Java programming language. @param colName the column name @return aRef
object representing the SQLREF
value in the specified column @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, int getRow()JDBCReturns2.0theGets avalue ofREF(<structured-type>)thecolumn value fromdesignated column in the current row of thisResultSet
object as aRef
object in the Java programming language. @param i the first column is 1 the second is 2 ... @return aRef
object representing an SQLREF
value @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, short getShort(String)JDBC 2.0Retrieves the current row number. The first row is number 1 the second number 2 and so on. @return the current row number;0
if there is no current row @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, short getShort(int)athe designated column in the current row of thisResultSet
object as ashort
in the Javashortprogramming language. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, Statement getStatement()athe designated column in the current row of thisResultSet
object as ashort
in the Javashortprogramming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned is0
@exception SQLException if a database access error occurs
Class ResultSet, String getString(String)JDBC 2.0Returns theStatement
object that produced thisResultSet
object. If the result set was generated some other way such as by aDatabaseMetaData
method this method returnsnull
. @return theStatment
object that producedthethisresultResultSet
setobject ornull
if the result set was produced some other way @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, String getString(int)athe designated column in the current row of thisResultSet
object as aString
in the JavaStringprogramming language. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, Time getTime(String)athe designated column in the current row of thisResultSet
object as aString
in the JavaStringprogramming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs
Gets the value ofClass ResultSet, Time getTime(String, Calendar)athe designated column in the current row of thisResultSet
object as ajava.sql.Time
object in the Java programming language. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs
Class ResultSet, Time getTime(int)GetsReturns the value ofathe designated column in the current row of thisResultSet
object as ajava.sql.Time
object in the Java programming language. This method uses the given calendar to construct an appropriate millisecond value for theTimetime if the underlying database does not store timezone information. @param columnName the SQL name of the column @param cal thejava.util.Calendar
object to use in constructing the time @param cal the calendar to use in constructing the time @return the column value as ajava.sql.Time
object; if the value is SQLNULL
theresultvalue returned isnull
in the Java programming language @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, Time getTime(int, Calendar)athe designated column in the current row of thisResultSet
object as ajava.sql.Time
object in the Java programming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs
Class ResultSet, Timestamp getTimestamp(String)GetsReturns the value ofathe designated column in the current row of thisResultSet
object as ajava.sql.Time
object in the Java programming language. This method uses the given calendar to construct an appropriate millisecond value for theTimetime if the underlying database does not store timezone information. @param columnIndex the first column is 1 the second is 2 ... @param cal thecalendarjava.util.Calendar
object to use in constructing the time @return the column value as ajava.sql.Time
object; if the value is SQLNULL
theresultvalue returned isnull
in the Java programming language @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, Timestamp getTimestamp(String, Calendar)athe designated column in the current row of thisResultSet
object as ajava.sql.Timestamp
object. @param columnName the SQL name of the column @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs
Class ResultSet, Timestamp getTimestamp(int)GetsReturns the value ofathe designated column in the current row of thisResultSet
object as ajava.sql.Timestamp
object in the Java programming language. This method uses the given calendar to construct an appropriate millisecond value for theTimestamptimestamp if the underlying database does not store timezone information. @param columnName the SQL name of the column @param cal thecalendarjava.util.Calendar
object to use in constructing thetimestampdate @return the column value as ajava.sql.Timestamp
object; if the value is SQLNULL
theresultvalue returned isnull
in the Java programming language @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, Timestamp getTimestamp(int, Calendar)athe designated column in the current row of thisResultSet
object as ajava.sql.Timestamp
object in the Java programming language. @param columnIndex the first column is 1 the second is 2 ... @return the column value; if the value is SQLNULL
theresultvalue returned isnull
@exception SQLException if a database access error occurs
Class ResultSet, int getType()GetsReturns the value ofathe designated column in the current row of thisResultSet
object as ajava.sql.Timestamp
object in the Java programming language. This method uses the given calendar to construct an appropriate millisecond value for theTimestamptimestamp if the underlying database does not store timezone information. @param columnIndex the first column is 1 the second is 2 ... @param cal thecalendarjava.util.Calendar
object to use in constructing the timestamp @return the column value as ajava.sql.Timestamp
object; if the value is SQLNULL
theresultvalue returned isnull
in the Java programming language @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, InputStream getUnicodeStream(String)JDBC 2.0Returns the type of thisresultResultSet
setobject. The type is determined by thestatementStatement
object that created the result set. @returnTYPE_FORWARD_ONLY
TYPE_SCROLL_INSENSITIVE
orTYPE_SCROLL_SENSITIVE
@exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Gets the value ofClass ResultSet, InputStream getUnicodeStream(int)athe designated column in the current row of thisResultSet
object as a stream of Unicode characters. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving largeLONGVARCHAR
values. The JDBC driver will do any necessary conversion from the database format into Unicode. The byte format of the Unicode stream must be Java UTF-8 as defined in the JavaVirtual Machine Specificationvirtual machine specification.Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a
getgetXXX
method implicitly closes the stream. Also a stream may return0
when the methodavailable
is called whether there is data available or not. @param columnName the SQL name of the column @return a Java input stream that delivers the database column value as a stream of two-byte Unicode characters. If the value is SQLNULL
thethenresultvalue returned isnull
. @exception SQLException if a database access error occurs @deprecated
Gets the value of a column in the current row as a stream of Gets the value of the designated column in the current row of thisClass ResultSet, SQLWarning getWarnings()ResultSet
object as as a stream of Unicode characters. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving largeLONGVARCHAR
values. The JDBC driver will do any necessary conversion from the database format into Unicode. The byte format of the Unicode stream must be Java UTF-8 as specified in the JavaVirtual Machine Specificationvirtual machine specification.Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a
getgetXXX
method implicitly closes the stream. Also a stream may return0
when the methodInputStream.available
is called whether there is data available or not. @param columnIndex the first column is 1 the second is 2 ... @return a Java input stream that delivers the database column value as a streamofin JavatwoUTF-byte8Unicodebytecharacters.format;Ifif the value is SQLNULL
thethenresultvalue returned isnull
@exception SQLException if a database access error occurs @deprecated use.getCharacterStream
in place ofgetUnicodeStream
Class ResultSet, void insertRow()TheReturns the first warning reported by calls on thisResultSet
isreturnedobject. Subsequent warnings on thisResultSet
warningsobject will be chained tothistheSQLWarning
object that this method returns.The warning chain is automatically cleared each time a new row is read.
Note: This warning chain only covers warnings caused by
ResultSet
methods. Any warning caused bystatementStatement
methods (such as reading OUT parameters) will be chained on theStatement
object. @return the firstSQLWarning
object reported ornull
@exception SQLException if a database access error occurs
Class ResultSet, boolean isAfterLast()JDBC 2.0Inserts the contents of the insert row intothethisresultResultSet
setobjaect and into the database.MustThe cursor must be on the insert row when this method is called. @exception SQLException if a database access error occurs if this method is called when the cursor is not on the insert row or if not all of non-nullable columns in the insert row have been given a value @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean isBeforeFirst()JDBC 2.0Indicates whether the cursor is after the last row inthethisresultResultSet
setobject. @returntrue
if the cursor is after the last row;false
otherwise.ifReturnsthefalsecursor iswhenat any other position or the result set contains no rows.@exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean isFirst()JDBC 2.0Indicates whether the cursor is before the first row inthethisresultResultSet
setobject. @returntrue
if the cursor is before the first row;false
otherwise.ifReturnsthefalsecursor iswhenat any other position or the result set contains no rows.@exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean isLast()JDBC 2.0Indicates whether the cursor is on the first row ofthethisresultResultSet
setobject. @returntrue
if the cursor is on the first row;false
otherwise.@exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean last()JDBC 2.0Indicates whether the cursor is on the last row ofthethisresultResultSet
setobject. Note: Calling the methodisLast
may be expensive because the JDBC driver might need to fetch ahead one row in order to determine whether the current row is the last row in the result set. @returntrue
if the cursor is on the last row;false
otherwise.@exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void moveToCurrentRow()JDBC 2.0Moves the cursor to the last row inthethisresultResultSet
setobject. @returntrue
if the cursor is on a valid row;false
if there are no rows in the result set @exception SQLException if a database access error occurs or the result set type isTYPE_FORWARD_ONLY
@since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void moveToInsertRow()JDBC 2.0Moves the cursor to the remembered cursor position usually the current row. This method has no effect if the cursor is not on the insert row. @exception SQLException if a database access error occurs or the result set is not updatable @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean next()JDBC 2.0Moves the cursor to the insert row. The current cursor position is remembered while the cursor is positioned on the insert row. The insert row is a special row associated with an updatable result set. It is essentially a buffer where a new row may be constructed by calling theupdateXXX
methods prior to inserting the row into the result set. Only theupdateXXX
getXXX
andinsertRow
methods may be called when the cursor is on the insert row. All of the columns in a result set must be given a value each time this method is called before callinginsertRow
.The methodAnupdateXXX
method must be called before agetXXX
method can be called on a column value. @exception SQLException if a database access error occurs or the result set is not updatable @since 1.2 @see What Is in the JDBC 2.0 API
Moves the cursor down one row from its current position. AClass ResultSet, boolean previous()ResultSet
cursor is initially positioned before the first row; the first call to the methodnext makes the first row the current row; the second call makes the second row the current row and so on.
If an input stream is open for the current row a call to the method
next
will implicitly close it.TheAResultSet
object's warning chain is cleared when a new row is read. @returntrue
if the new current row is valid;false
if there are no more rows @exception SQLException if a database access error occurs
Class ResultSet, void refreshRow()JDBC 2.0Moves the cursor to the previous row inthethisresultResultSet
setobject.Note: Calling the method
previous()
is not the same as calling the methodrelative(-1)
because it makes sense to callprevious() when there is no current row. @returntrue
if the cursor is on a valid row;false
if it is off the result set @exception SQLException if a database access error occurs or the result set type isTYPE_FORWARD_ONLY
@since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean relative(int)JDBC 2.0Refreshes the current row with its most recent value in the database.CannotThis method cannot be called when the cursor is on the insert row.The
refreshRow
method provides a way for an application to explicitly tell the JDBC driver to refetch a row(s) from the database. An application may want to callrefreshRow
when caching or prefetching is being done by the JDBC driver to fetch the latest value of a row from the database. The JDBC driver may actually refresh multiple rows at once if the fetch size is greater than one.All values are refetched subject to the transaction isolation level and cursor sensitivity. If
refreshRow
is called after calling anupdateXXX
method but before calling the methodupdateRow
then the updates made to the row are lost. Calling the methodrefreshRow
frequently will likely slow performance. @exception SQLException if a database access error occurs or if this method is called when the cursor is on the insert row @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean rowDeleted()JDBC 2.0Moves the cursor a relative number of rows either positive or negative. Attempting to move beyond the first/last row in the result set positions the cursor before/after the the first/last row. Callingrelative(0)
is valid but does not change the cursor position.Note: Calling the method
relative(1)
is different from calling the methodnext()
because is makes sense to callnext()
when there is no current row for example when the cursor is positioned before the first row or after the last row of the result set. @returntrue
if the cursor is on a row;false
otherwise @exception SQLException if a database access error occurs there is no current row or the result set type isTYPE_FORWARD_ONLY
@since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean rowInserted()JDBC 2.0Indicates whether a row has been deleted. A deleted row may leave a visible "hole" in a result set. This method can be used to detect holes in a result set. The value returned depends on whether or notthethisresultResultSet
setobject can detect deletions. @returntrue
if a row was deleted and deletions are detected;false
otherwise @exception SQLException if a database access error occurs @see DatabaseMetaData#deletesAreDetected @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean rowUpdated()JDBC 2.0Indicates whether the current row has had an insertion. The value returned depends on whether or notthethisresultResultSet
setobject can detect visible inserts. @returntrue
if a row has had an insertion and insertions are detected;false
otherwise @exception SQLException if a database access error occurs @see DatabaseMetaData#insertsAreDetected @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void setFetchDirection(int)JDBC 2.0Indicates whether the current row has been updated. The value returned depends on whether or not the result set can detect updates. @returntrue
if the row has been visibly updated by the owner or another and updates are detected @exception SQLException if a database access error occurs @see DatabaseMetaData#updatesAreDetected @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void setFetchSize(int)JDBC 2.0Gives a hint as to the direction in which the rows in thisresultResultSet
setobject will be processed. The initial value is determined by thestatementStatement
object that producedthethisresultResultSet
setobject. The fetch direction may be changed at any time. @exception SQLException if a database access error occurs or the result set type isTYPE_FORWARD_ONLY
and the fetch direction is notFETCH_FORWARD
@since 1.2 @see What Is in the JDBC 2.0 API @see Statement#setFetchDirection
Class ResultSet, void updateAsciiStream(String, InputStream, int)JDBC 2.0Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for thisresultResultSet
setobject. If the fetch size specified is zero the JDBC driver ignores the value and is free to make its own best guess as to what the fetch size should be. The default value is set by thestatementStatement
object that created the result set. The fetch size may be changed at any time. @param rows the number of rows to fetch @exception SQLException if a database access error occurs or the condition0 < rows < this.getMaxRows()
is not satisfied @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateAsciiStream(int, InputStream, int)JDBC 2.0Updatesathe designated column with an ascii stream value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @param length the length of the stream @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateBigDecimal(String, BigDecimal)JDBC 2.0Updatesathe designated column with an ascii stream value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @param length the length of the stream @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateBigDecimal(int, BigDecimal)JDBC 2.0Updatesathe designated column with ajava.sql.BigDecimal
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateBinaryStream(String, InputStream, int)JDBC 2.0Updatesathe designated column with ajava.math.BigDecimal
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateBinaryStream(int, InputStream, int)JDBC 2.0Updatesathe designated column with a binary stream value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @param length the length of the stream @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateBoolean(String, boolean)JDBC 2.0Updatesathe designated column with a binary stream value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @param length the length of the stream @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateBoolean(int, boolean)JDBC 2.0Updatesathe designated column with aboolean
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateByte(String, byte)JDBC 2.0Updatesathe designated column with aboolean
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateByte(int, byte)JDBC 2.0Updatesathe designated column with abyte
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateBytes(String, byte[])JDBC 2.0Updatesathe designated column with abyte
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Updates the designated column with aClass ResultSet, void updateBytes(int, byte[])boolean
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. JDBC 2.0 Updates a column with a byte array value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateCharacterStream(String, Reader, int)JDBC 2.0Updatesathe designated column with abyte
array value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateCharacterStream(int, Reader, int)JDBC 2.0Updatesathe designated column with a character stream value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @param length the length of the stream @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateDate(String, Date)JDBC 2.0Updatesathe designated column with a character stream value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @param length the length of the stream @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateDate(int, Date)JDBC 2.0Updatesathe designated column with ajava.sql.Date
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateDouble(String, double)JDBC 2.0Updatesathe designated column with ajava.sql.Date
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateDouble(int, double)JDBC 2.0Updatesathe designated column with adouble
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateFloat(String, float)JDBC 2.0Updatesathe designated column with aDoubledouble
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateFloat(int, float)JDBC 2.0Updatesathe designated column with afloat
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateInt(String, int)JDBC 2.0Updatesathe designated column with afloat
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateInt(int, int)JDBC 2.0Updatesathe designated column with anintegerint
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateLong(String, long)JDBC 2.0Updatesathe designated column with anintegerint
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateLong(int, long)JDBC 2.0Updatesathe designated column with along
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateNull(String)JDBC 2.0Updatesathe designated column with along
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateNull(int)JDBC 2.0Updatesathe designated column with anull
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateObject(String, Object)JDBC 2.0 GiveGives a nullable column a null value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateObject(String, Object, int)JDBC 2.0Updatesathe designated column with anObject
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateObject(int, Object)JDBC 2.0Updatesathe designated column with anObject
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @param scaleForforjava.sql.Types.
orDECIMALDECIMAjava.sql.Types.NUMERIC
types this is the number of digits after the decimal point. For all other types this value will be ignored. @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateObject(int, Object, int)JDBC 2.0Updatesathe designated column with anObject
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateRow()JDBC 2.0Updatesathe designated column with anObject
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @param scaleForforjava.sql.Types.
orDECIMALDECIMAjava.sql.Types.NUMERIC
types this is the number of digits after the decimal point. For all other types this value will be ignored. @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateShort(String, short)JDBC 2.0Updates the underlying database with the new contents of the current row of thisResultSet
object.CannotThis method cannot be called when the cursor is on the insert row. @exception SQLException if a database access error occurs or if this method is called when the cursor is on the insert row @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateShort(int, short)JDBC 2.0Updatesathe designated column with ashort
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateString(String, String)JDBC 2.0Updatesathe designated column with ashort
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateString(int, String)JDBC 2.0Updatesathe designated column with aString
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateTime(String, Time)JDBC 2.0Updatesathe designated column with aString
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateTime(int, Time)JDBC 2.0Updatesathe designated column with ajava.sql.Time
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateTimestamp(String, Timestamp)JDBC 2.0Updatesathe designated column with ajava.sql.Time
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, void updateTimestamp(int, Timestamp)JDBC 2.0Updatesathe designated column with ajava.sql.Timestamp
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnName the name of the column @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, boolean wasNull()JDBC 2.0Updatesathe designated column with ajava.sql.Timestamp
value. TheupdateXXX
methods are used to update column values in the current row or the insert row. TheupdateXXX
methods do not update the underlying database; instead theupdateRow
orinsertRow
methods are called to update the database. @param columnIndex the first column is 1 the second is 2 ... @param x the new column value @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Reports whether the last column read had a value of SQLClass ResultSet, int CONCUR_READ_ONLYNULL
. Note that you must first call one of thegetXXX methods on a column to try to read its value and then call the method
wasNull
()to see if the value read was SQLNULL
. @returntrue
if the last column value read was SQLNULL
andfalse
otherwise @exception SQLException if a database access error occurs
Class ResultSet, int CONCUR_UPDATABLEJDBCThe2.0constantTheindicating the concurrency mode for aResultSet
object that may NOT be updated. @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, int FETCH_FORWARDJDBCThe2.0constantTheindicating the concurrency mode for aResultSet
object that may be updated. @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, int FETCH_REVERSEJDBCThe2.0constantTheindicating that the rows in a result set will be processed in a forward direction; first-to-last. This constant is used by the methodsetFetchDirection
as a hint to the driver which the driver may ignore. @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, int FETCH_UNKNOWNJDBCThe2.0constantTheindicating that the rows in a result set will be processed in a reverse direction; last-to-first. This constant is used by the methodsetFetchDirection
as a hint to the driver which the driver may ignore. @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, int TYPE_FORWARD_ONLYJDBCThe2.0constantTheindicating that the order in which rows in a result set will be processed is unknown. This constant is used by the methodsetFetchDirection
as a hint to the driver which the driver may ignore.
Class ResultSet, int TYPE_SCROLL_INSENSITIVEJDBCThe2.0constantTheindicating the type for aResultSet
object whose cursor may move only forward. @since 1.2 @see What Is in the JDBC 2.0 API
Class ResultSet, int TYPE_SCROLL_SENSITIVEJDBCThe2.0constantTheindicating the type for aResultSet
object that is scrollable but generally not sensitive to changes made by others. @since 1.2 @see What Is in the JDBC 2.0 API
JDBCThe2.0constantTheindicating the type for aResultSet
object that is scrollable and generally sensitive to changes made by others. @since 1.2 @see What Is in the JDBC 2.0 API
An object that can be used toClass ResultSetMetaData, String getCatalogName(int)find outget information about the types and properties of the columns in aResultSet
object. The following code fragment creates theResultSet
object rs creates theResultSetMetaData
object rsmd and uses rsmd to find out how many columns rs has and whether the first column in rs can be used in aWHERE
clause.ResultSet rs = stmt.executeQuery("SELECT a b c FROM TABLE2"); ResultSetMetaData rsmd = rs.getMetaData(); int numberOfColumns = rsmd.getColumnCount(); boolean b = rsmd.isSearchable(1);
GetsClass ResultSetMetaData, String getColumnClassName(int)athe designated column's table's catalog name. @param column the first column is 1 the second is 2 ... @return column name or "" if not applicable.@exception SQLException if a database access error occurs
Class ResultSetMetaData, int getColumnCount()JDBC 2.0Returns the fully-qualified name of the Java class whose instances are manufactured if the method
ResultSet.getObject
is called to retrieve a value from the column.ResultSet.getObject
may return a subclass of the class returned by this method. @return the fully-qualified name of the class in the Java programming language that would be used by the methodResultSet.getObject
to retrieve the value in the specified column. This is the class name used for custom mapping. @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Returns the number of columns in this ResultSet
object. @return the number of columns @exception SQLException if a database access error occurs
Class ResultSetMetaData, int getColumnDisplaySize(int)Indicates the designated column's normalClass ResultSetMetaData, String getColumnLabel(int)maxmaximum width incharscharacters. @param column the first column is 1 the second is 2 ... @return the normal maximum number of characters allowed as the width of the designated column @exception SQLException if a database access error occurs
Gets theClass ResultSetMetaData, String getColumnName(int)suggesteddesignated column's suggested title for use in printouts and displays. @param column the first column is 1 the second is 2 ... @return the suggested column title @exception SQLException if a database access error occurs
Class ResultSetMetaData, int getColumnType(int)GetsGetathe designated column's name. @param column the first column is 1 the second is 2 ... @return column name @exception SQLException if a database access error occurs
RetrievesClass ResultSetMetaData, String getColumnTypeName(int)athe designated column's SQL type. @param column the first column is 1 the second is 2 ... @return SQL type from java.sql.Types @exception SQLException if a database access error occurs @see Types
RetrievesClass ResultSetMetaData, int getPrecision(int)athe designated column's database-specific type name. @param column the first column is 1 the second is 2 ... @return type name used by the database. If the column type is a user-defined type then a fully-qualified type name is returned. @exception SQLException if a database access error occurs
Class ResultSetMetaData, int getScale(int)GetsGetathe designated column's number of decimal digits. @param column the first column is 1 the second is 2 ... @return precision @exception SQLException if a database access error occurs
GetsClass ResultSetMetaData, String getSchemaName(int)athe designated column's number of digits to right of the decimal point. @param column the first column is 1 the second is 2 ... @return scale @exception SQLException if a database access error occurs
Class ResultSetMetaData, String getTableName(int)GetsGetathe designated column's table's schema. @param column the first column is 1 the second is 2 ... @return schema name or "" if not applicable @exception SQLException if a database access error occurs
GetsClass ResultSetMetaData, boolean isAutoIncrement(int)athe designated column's table name. @param column the first column is 1 the second is 2 ... @return table name or "" if not applicable @exception SQLException if a database access error occurs
Indicates whether the designated column is automatically numbered thus read-only. @param column the first column is 1 the second is 2 ... @returnClass ResultSetMetaData, boolean isCaseSensitive(int)true
if so;false
otherwise @exception SQLException if a database access error occurs
Indicates whether a column's case matters. @param column the first column is 1 the second is 2 ... @returnClass ResultSetMetaData, boolean isCurrency(int)true
if so;false
otherwise @exception SQLException if a database access error occurs
Indicates whether the designated column is a cash value. @param column the first column is 1 the second is 2 ... @returnClass ResultSetMetaData, boolean isDefinitelyWritable(int)true
if so;false
otherwise @exception SQLException if a database access error occurs
Indicates whether a write on the designated column will definitely succeed. @param column the first column is 1 the second is 2 ... @returnClass ResultSetMetaData, int isNullable(int)true
if so;false
otherwise @exception SQLException if a database access error occurs
Indicates the nullability of values in the designated column. @param column the first column is 1 the second is 2 ... @return the nullability status of the given column; one ofClass ResultSetMetaData, boolean isReadOnly(int)columnNoNulls
columnNullable
orcolumnNullableUnknown
@exception SQLException if a database access error occurs
Indicates whetherClass ResultSetMetaData, boolean isSearchable(int)athe designated column is definitely not writable. @param column the first column is 1 the second is 2 ... @returntrue
if so;false
otherwise @exception SQLException if a database access error occurs
Indicates whether the designated column can be used in a where clause. @param column the first column is 1 the second is 2 ... @returnClass ResultSetMetaData, boolean isSigned(int)true
if so;false
otherwise @exception SQLException if a database access error occurs
Indicates whether values in the designated column are signed numbers. @param column the first column is 1 the second is 2 ... @returnClass ResultSetMetaData, boolean isWritable(int)true
if so;false
otherwise @exception SQLException if a database access error occurs
Indicates whether it is possible for a write on the designated column to succeed. @param column the first column is 1 the second is 2 ... @returnClass ResultSetMetaData, int columnNoNullstrue
if so;false
otherwise @exception SQLException if a database access error occurs
Class ResultSetMetaData, int columnNullableColumnThe constant indicating that a column does not allowNULL
values.
Class ResultSetMetaData, int columnNullableUnknownColumnThe constant indicating that a column allowsNULL
values.
NullabilityThe constant indicating that the nullability of a column's values is unknown.
Class SQLData, String getSQLTypeName()JDBC 2.0The interface used for the custom mapping of SQL user-defined types. This interface must be implemented byaany Java class that is registered in a type mapping. It is expected that this interface will normally be implemented by a tool. The methods in this interface are called by the driver and are never called by a programmer directly. @since 1.2 @see What Is in the JDBC 2.0 API
Returns the fully-qualified name of the SQL user-defined type that this object represents. This method is called by the JDBC driver to get the name of the UDT instance that is being mapped to this instance ofClass SQLData, void readSQL(SQLInput, String)SQLData
. @returnsreturn the type name that was passed to the methodreadSql
when this object was constructed and populated @exception SQLException if there is a database access error @since 1.2 @see What Is in the JDBC 2.0 API
Populates this object with data read from the database. The implementation of the method must follow this protocol:Class SQLData, void writeSQL(SQLOutput)It must read each of the attributes or elements of the SQL type from the given input stream. This is done by calling a method of the input stream to read each item in the order that they appear in the SQL definition of the type.
The JDBC driver initializes the input stream with a type map before calling this method which is used by the appropriate- The method
readSQL
then assigns the data to appropriate fields or elements (of this or other objects). Specifically it must call the appropriateSQLInput.readXXX
method(s) to do the following: for aDistinct Typedistinct type read its single data element; for aStructuredstructuredTypetype read a value for each attribute of the SQL type.SQLInput.readXXX
method on the stream. @param stream theinputSQLInput
SQLobject from which to read the datastreamfor the value that is being custom mapped @paramdescriptortypeName the SQL type name of the value on the data stream @exception SQLException if there is a database access error @see SQLInput
Writes this object to the given SQL data stream converting it back to its SQL value in the data source. The implementation of the method must follow this protocol:
It must write each of the attributes of the SQL type to the given output stream. This is done by calling a method of the output stream to write each item in the order that they appear in the SQL definition of the type. Specifically it must call the appropriateSQLOutput.writeXXX
method(s) to do the following: for a Distinct Type write its single data element; for a Structured Type write a value for each attribute of the SQL type. @param stream theoutputSQLOutput
SQLobject to which to write the datastreamfor the value that was custom mapped @exception SQLException if there is a database access error @see SQLOutput @since 1.2 @see What Is in the JDBC 2.0 API
Class SQLException, constructor SQLException()An exception that provides information on a database access error or other errors.
Each
SQLException
provides several kinds of information:
- a string describing the error. This is used as the Java Exception message available via the method
getMesage
.- a "SQLstate" string which follows the XOPEN SQLstate conventions. The values of the SQLState string are described in the XOPEN SQL spec.
- an integer error code that is specific to each vendor. Normally this will be the actual error code returned by the underlying database.
- a chain to a next Exception. This can be used to provide additional error information.
Constructs anClass SQLException, constructor SQLException(String)SQLException
object; reason defaults to null SQLState defaults tonull
and vendorCode defaults to 0.
Constructs anClass SQLException, SQLException getNextException()SQLException
object with a reason; SQLState defaults tonull
and vendorCode defaults to 0. @param reason a description of the exception
Retrieves the exception chained to thisClass SQLException, void setNextException(SQLException)SQLException
object. @return the nextSQLException
object in the chain;null
if there are none
Adds anSQLException
object to the end of the chain. @param ex the new exception that will be added to the end of theSQLException
chain
Class SQLInput, Array readArray()JDBC 2.0 AAn input stream that contains a stream of values representing an instance of an SQL structured or distinct type. This interface used only for custom mapping is used by the driver behind the scenes and a programmer never directly invokesSQLInput
methods. ThereadXXX
methods provide a way to read the values in anSQLInput
object. The methodwasNull
is used to determine whether the the last value read was SQLNULL
.When the method
getObject
is called with an object of a class implementing the interfaceSQLData
the JDBC driver calls the methodSQLData.getSQLType
to determine the SQL type of the user-defined type (UDT) being custom mapped. The driver creates an instance ofSQLInput
populating it with the attributes of the UDT. The driver then passes the input stream to the methodSQLData.readSQL
which in turn calls theSQLInput.readXXX
methods in its implementation for reading the attributes from the input stream. @since 1.2 @see What Is in the JDBC 2.0 API
Reads anClass SQLInput, InputStream readAsciiStream()arraySQLARRAY
value from the stream and returns it as anArray
object in the Java programming language. @return anArray
object representing data of the SQLarrayARRAY
value at the head of the stream;null
if the value read is SQLNULL
@exception SQLException if a database access error occurs
Returns the next attribute in the stream as a stream of ASCII characters. @return the attribute; if the value is SQLClass SQLInput, BigDecimal readBigDecimal()NULL
returnreturnsnull
@exception SQLException if a database access error occurs.
Reads the next attribute in the stream as aClass SQLInput, InputStream readBinaryStream()java.math.BigDecimal
object in the Java programming language. @return the attribute; if the value is SQLNULL
returnreturnsnull
@exception SQLException if a database access error occurs.
Returns the next attribute in the stream as a stream of uninterpreted bytes. @return the attribute; if the value is SQLClass SQLInput, Blob readBlob()NULL
returnreturnsnull
@exception SQLException if a database access error occurs.
ReadsClass SQLInput, boolean readBoolean()aan SQLBLOB
value from the stream and returns it as aBlob
object in the Java programming language. @returnanaBlob
object representing data of the SQLBLOB
value at the head of the stream;null
if the value read is SQLNULL
@exception SQLException if a database access error occurs
Reads the next attribute in the stream as aClass SQLInput, byte readByte()boolean
in the Javabooleanprogramming language. @return the attribute; if the value is SQLNULL
returnreturnsnull.false
@exception SQLException if a database access error occurs
Reads the next attribute in the stream as aClass SQLInput, byte[] readBytes()byte
in the Javabyteprogramming language. @return the attribute; if the value is SQLNULL
returnreturnsnull.0
@exception SQLException if a database access error occurs
Reads the next attribute in the stream as an array of bytes in the Java programming language. @return the attribute; if the value is SQLClass SQLInput, Reader readCharacterStream()NULL
returnreturnsnull
@exception SQLException if a database access error occurs.
Returns the next attribute in the stream as a stream of Unicode characters. @return the attribute; if the value is SQLClass SQLInput, Clob readClob()NULL
returnreturnsnull
@exception SQLException if a database access error occurs.
ReadsClass SQLInput, Date readDate()aan SQLCLOB
value from the stream and returns it as aClob
object in the Java programming language. @returnanaClob
object representing data of the SQLCLOB
value at the head of the stream;null
if the value read is SQLNULL
@exception SQLException if a database access error occurs
Reads the next attribute in the stream as aClass SQLInput, double readDouble()java.sql.Date
object. @return the attribute; if the value is SQLNULL
returnreturnsnull
@exception SQLException if a database access error occurs.
Reads the next attribute in the stream as aClass SQLInput, float readFloat()double
in the Javadoubleprogramming language. @return the attribute; if the value is SQLNULL
returnreturnsnull.0
@exception SQLException if a database access error occurs
Reads the next attribute in the stream as aClass SQLInput, int readInt()float
in the Javafloatprogramming language. @return the attribute; if the value is SQLNULL
returnreturnsnull.0
@exception SQLException if a database access error occurs
Reads the next attribute in the stream asClass SQLInput, long readLong()aanint
in the Javaintprogramming language. @return the attribute; if the value is SQLNULL
returnreturnsnull.0
@exception SQLException if a database access error occurs
Reads the next attribute in the stream as aClass SQLInput, Object readObject()long
in the Javalongprogramming language. @return the attribute; if the value is SQLNULL
returnreturnsnull.0
@exception SQLException if a database access error occurs
Returns the datum at the head of the stream asClass SQLInput, Ref readRef()aanObject
in the Javaobjectprogramming language. The actual type of the object returned is determined by the default type mapping and any customizations present in this stream's type map.A type map is registered with the stream by the JDBC driver before the stream is passed to the application.
When the datum at the head of the stream is an SQL
NULL
the method returnsnull
. If the datum is an SQL structured or distinct type it determines the SQL type of the datum at the head of the stream. If the stream's type map has an entry for that SQL type the driver constructs an object of the appropriate class and calls the methodSQLData.readSQL
on that object which reads additional data from the stream using the protocol described for that method. @return the datum at the head of the stream asaanObject
in the Javaobject;programming language;null if the datum is SQL
NULL
@exception SQLException if a database access error occurs
ReadsClass SQLInput, short readShort()aan SQLREF
value from the stream and returns it as a(<structured-type>)Ref
object in the Java programming language. @returnanaRef
object representingdata ofthe SQLREF
value at the head of the stream;null
if the value read is SQLNULL
@exception SQLException if a database access error occurs
Reads the next attribute in the stream as aClass SQLInput, String readString()short
in the Javashortprogramming language. @return the attribute; if the value is SQLNULL
returnreturnsnull.0
@exception SQLException if a database access error occurs
Reads the next attribute in the stream as aClass SQLInput, Time readTime()String
in the JavaStringprogramming language. @return the attribute; if the value is SQLNULL
returnreturnsnull
@exception SQLException if a database access error occurs.
Reads the next attribute in the stream as aClass SQLInput, Timestamp readTimestamp()java.sql.Time
object. @return the attribute; if the value is SQLNULL
returnreturnsnull
@exception SQLException if a database access error occurs.
Reads the next attribute in the stream as aClass SQLInput, boolean wasNull()java.sql.Timestamp
object. @return the attribute; if the value is SQLNULL
returnreturnsnull
@exception SQLException if a database access error occurs.
Determines whether the last value read wasnullSQLNULL
. @returntrue
if the most recentlygottenread SQL value wasnullSQLNULL
; otherwisefalse
@exception SQLException if a database access error occurs
Class SQLOutput, void writeArray(Array)JDBC 2.0The output stream for writing the attributes of a user-defined type back to the database. This interface used only for custom mapping is used by the driver and its methods are never directly invoked by a programmer.When an object of a class implementing the interface
SQLData
is passed as an argument to an SQL statement the JDBC driver calls the methodSQLData.getSQLType
to determine the kind of SQL datum being passed to the database. The driver then creates an instance ofSQLOutput
and passes it to the methodSQLData.writeSQL
. The methodwriteSQL
in turn calls the appropriateSQLOutput.writeXXX
methods to write data from theSQLData
object to theSQLOutput
output stream as the representation of an SQL user-defined type. @since 1.2 @see What Is in the JDBC 2.0 API
Writes anClass SQLOutput, void writeAsciiStream(InputStream)arraySQLARRAY
value to the stream. @param x anArray
object representing data of an SQLarrayARRAY
type @exception SQLException if a database access error occurs
Class SQLOutput, void writeBigDecimal(BigDecimal)ReturnsWrites the next attribute to the stream as a stream of ASCII characters. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Writes the next attribute to the stream as a java.math.BigDecimal object. Writes the next attribute to the stream as aClass SQLOutput, void writeBinaryStream(InputStream)String
in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Class SQLOutput, void writeBlob(Blob)ReturnsWrites the next attribute to the stream as a stream of uninterpreted bytes. @param x the value to pass to the database.@exception SQLException if a database access error occurs
WritesClass SQLOutput, void writeBoolean(boolean)aan SQLBLOB value to the stream. @param x
anaBlob
object representingadata of an SQLBLOB
value @exception SQLException if a database access error occurs
Writes the next attribute to the stream as a Java boolean. Writes the next attribute to the stream as aClass SQLOutput, void writeByte(byte)String
in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Writes the next attribute to the stream as a Java byte. Writes the next attribute to the stream as aClass SQLOutput, void writeBytes(byte[])String
in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Writes the next attribute to the stream as an array of bytes. Writes the next attribute to the stream as aClass SQLOutput, void writeCharacterStream(Reader)String
in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Class SQLOutput, void writeClob(Clob)ReturnsWrites the next attribute to the stream as a stream of Unicode characters. @param x the value to pass to the database.@exception SQLException if a database access error occurs
WritesClass SQLOutput, void writeDate(Date)aan SQLCLOB value to the stream. @param x
anaClob
object representingadata of an SQLCLOB
value @exception SQLException if a database access error occurs
Writes the next attribute to the stream as a java.sql.Date object. Writes the next attribute to the stream as aClass SQLOutput, void writeDouble(double)java.sql.Date
object in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Writes the next attribute to the stream as a Java double. Writes the next attribute to the stream as aClass SQLOutput, void writeFloat(float)String
in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Writes the next attribute to the stream as a Java float. Writes the next attribute to the stream as aClass SQLOutput, void writeInt(int)String
in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Writes the next attribute to the stream as a Java int. Writes the next attribute to the stream as aClass SQLOutput, void writeLong(long)String
in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Writes the next attribute to the stream as a Java long. Writes the next attribute to the stream as aClass SQLOutput, void writeObject(SQLData)String
in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Writes to the stream the data contained in the givenClass SQLOutput, void writeRef(Ref)SQLData
object. When theSQLData
object isnull
this method writes an SQLNULL
to the stream. Otherwise it calls theSQLData.writeSQL
method of the given object which writes the object's attributes to the stream. The implementation of the methodSQLData.writeSQ
calls the appropriateSQLOutput.writeXXX
method(s) for writing each of the object's attributes in order. The attributes must be read from anSQLInput
input stream and written to anSQLOutput
output stream in the same order in which they were listed in the SQL definition of the user-defined type. @param x the object representing data of an SQL structured or distinct type @exception SQLException if a database access error occurs
WritesClass SQLOutput, void writeShort(short)aan SQLREF
value to the stream. @param x(<structured-type>)anaRef
object representing data of an SQLREF
Typevalue @exception SQLException if a database access error occurs
Writes the next attribute to the stream as a Java short. Writes the next attribute to the stream as aClass SQLOutput, void writeString(String)String
in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Writes the next attribute to the stream as aClass SQLOutput, void writeStruct(Struct)String
in the JavaStringprogramming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
WritesClass SQLOutput, void writeTime(Time)aan SQL structured-type value to the stream. @param xanaStruct
object representing data ofa Structuredan SQLTypestructured type @exception SQLException if a database access error occurs
Writes the next attribute to the stream as a java.sql.Time object. Writes the next attribute to the stream as aClass SQLOutput, void writeTimestamp(Timestamp)java.sql.Date
object in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Writes the next attribute to the stream as a java.sql.Timestamp object. Writes the next attribute to the stream as ajava.sql.Date
object in the Java programming language. @param x the value to pass to the database.@exception SQLException if a database access error occurs
Constructs a defaultClass SQLWarning, constructor SQLWarning(String)SQLWarning
object. The reason defaults tonull
SQLState defaults tonull
and vendorCode defaults to 0.
Constructs anClass SQLWarning, SQLWarning getNextWarning()SQLWarning
object with the given value for a reason; SQLState defaults tonull
and vendorCode defaults to 0. @param reason a description of the warning
Retrieves the warning chained to thisSQLWarning
object. @return the nextSQLException
in the chain;null
if none
Class Statement, void addBatch(String)The object used for executing a static SQL statement and obtaining the results produced by it.
Only one
ResultSet
object perStatement
object can be open at any point in time. Therefore if the reading of oneResultSet
object is interleaved with the reading of another each must have been generated by differentStatementsStatement
objects. All statementexecute
methods implicitly close a statment's currentResultSet
object if an open one exists. @see Connection#createStatement @see ResultSet
Class Statement, void clearBatch()JDBC 2.0Addsaan SQL command to the current batch of commmands forthethisstatementStatement
object. This method is optional. @param sql typically this is a static SQLINSERT
orUPDATE
statement @exception SQLException if a database access error occurs or the driver does not support batch statements @since 1.2 @see What Is in the JDBC 2.0 API
Class Statement, void clearWarnings()JDBC 2.0Makes the set of commands in the current batch empty. This method is optional. @exception SQLException if a database access error occurs or the driver does not support batch statements @since 1.2 @see What Is in the JDBC 2.0 API
Clears all the warnings reported on thisClass Statement, void close()Statement
object. After a call to this method the methodgetWarnings
will returnnull
until a new warning is reported for thisStatement
object. @exception SQLException if a database access error occurs
Releases thisClass Statement, boolean execute(String)Statement
object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed. It is generally good practice to release resources as soon as you are finished with them to avoid tying up database resources.Note: A
Statement
object is automatically closed when it is garbage collected. When aStatement
object is closed its currentResultSet
object if one exists is also closed. @exception SQLException if a database access error occurs
ExecutesClass Statement, int[] executeBatch()aan SQL statement that may return multiple results. Under some (uncommon) situations a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string. The methodsexecute
getMoreResults
getResultSet
andgetUpdateCount
let you navigate through multiple results. Theexecute
method executesaan SQL statement and indicates the form of the first result. You can then use the methodsgetResultSet or
getUpdateCount
to retrieve the result andgetMoreResults
to move to any subsequent result(s). @param sql any SQL statement @returntrue
if the next result is aResultSet
object;false
if it is an update count or there are no more results @exception SQLException if a database access error occurs @see #getResultSet @see #getUpdateCount @see #getMoreResults
Class Statement, ResultSet executeQuery(String)JDBC 2.0Submits a batch of commands to the database for execution and if all commands execute successfully returns an array of update counts. Theint
elements of the array that is returned are ordered to correspond to the commands in the batch which are ordered according to the order in which they were added to the batch. The elements in the array returned by the methodexecuteBatch
may be one of the following:.
- A number greater than or equal to zero -- indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution
- A value of
-2
-- indicates that the command was processed successfully but that the number of rows affected is unknownIf one of the commands in a batch update fails to execute properly this method throws a
BatchUpdateException
and a JDBC driver may or may not continue to process the remaining commands in the batch. However the driver's behavior must be consistent with a particular DBMS either always continuing to process commands or never continuing to process commandsThisIf the driver continues processing after a failure the array returned by the methodBatchUpdateException.getUpdateCounts
will contain as many elements as there are commands in the batch and at least one of the elements will be the following:
A value of -3
-- indicates that the command failed to execute successfully and occurs only if a driver continues to process commands after a command failsA driver is
optionalnot required to implement this method. The possible implementations and return values have been modified in the Java 2 SDK Standard Edition version 1.3 to accommodate the option of continuing to proccess commands in a batch update after aBatchUpdateException
obejct has been thrown. @return an array of update counts containing one element for each command in the batch. The elements of the arrayisare ordered according to the order in which commands wereinsertedaddedintoto the batch. @exception SQLException if a database access error occurs or the driver does not support batch statements. Throws BatchUpdateException (a subclass ofSQLException
) if one of the commands sent to the database fails to execute properly or attempts to return a result set. @since 1.3 @see What Is in the JDBC 2.0 API
ExecutesClass Statement, int executeUpdate(String)aan SQL statement that returns a singleResultSet
object. @param sql typically this is a static SQLSELECT
statement @return aResultSet
object that contains the data produced by the given query; nevernull
@exception SQLException if a database access error occurs
Executes an SQLClass Statement, Connection getConnection()INSERT
UPDATE
orDELETE
statement. In addition SQL statements that return nothing such as SQL DDL statements can be executed. @param sqlaan SQLINSERT
UPDATE
orDELETE
statement oraan SQL statement that returns nothing @return either the row count forINSERT
UPDATE
orDELETE
statements or 0 for SQL statements that return nothing @exception SQLException if a database access error occurs
Class Statement, int getFetchDirection()JDBC 2.0Returns theConnection
object that produced thisStatement
object. @return the connection that produced this statement @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class Statement, int getFetchSize()JDBC 2.0Retrieves the direction for fetching rows from database tables that is the default for result sets generated from thisStatement
object. If thisStatement
object has not set a fetch direction by calling the methodsetFetchDirection
the return value is implementation-specific. @return the default fetch direction for result sets generated from thisStatement
object @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Class Statement, int getMaxFieldSize()JDBC 2.0Retrieves the number of result set rows that is the default fetch size for result sets generated from thisStatement
object. If thisStatement
object has not set a fetch size by calling the methodsetFetchSize
the return value is implementation-specific. @return the default fetch size for result sets generated from thisStatement
object @exception SQLException if a database access error occurs @since 1.2 @see What Is in the JDBC 2.0 API
Returns the maximum number of bytes allowed for any column value. This limit is the maximum number of bytes that can be returned for any column value. The limit applies only toClass Statement, int getMaxRows()BINARY
VARBINARY
LONGVARBINARY
CHAR
VARCHAR
andLONGVARCHAR
columns. If the limit is exceeded the excess data is silently discarded. @return the current max column size limit; zero means unlimited @exception SQLException if a database access error occurs
Retrieves the maximum number of rows that a ResultSet
object can contain. If the limit is exceeded the excess rows are silently dropped. @return the current max row limit; zero means unlimited @exception SQLException if a database access error occurs
Class Statement, boolean getMoreResults()Moves to aClass Statement, int getQueryTimeout()Statement
object's next result. It returnstrue
if this result is aResultSet
object. This method also implicitly closes any currentResultSet
object obtained with the methodgetResultSet.
There are no more results when the following is true:
( getMoreResults() && (getUpdateCount() == -1) @returntrue
if the next result is aResultSet
object;false
if it is an update count or there are no more results @exception SQLException if a database access error occurs @see #execute
Retrieves the number of seconds the driver will wait for aClass Statement, ResultSet getResultSet()Statement
object to execute. If the limit is exceeded aSQLException
is thrown. @return the current query timeout limit in seconds; zero means unlimited @exception SQLException if a database access error occurs
Returns the current result as aClass Statement, int getResultSetConcurrency()ResultSet
object. This method should be called only once per result. @return the current result as aResultSet
object;null
if the result is an update count or there are no more results @exception SQLException if a database access error occurs @see #execute
Class Statement, int getResultSetType()JDBC 2.0Retrieves the result set concurrency forResultSet
objects generated by thisStatement
object. @return eitherResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
@since 1.2 @see What Is in the JDBC 2.0 API
Class Statement, int getUpdateCount()JDBC 2.0 DetermineRetrieves the result set type forResultSet
objects generated by thisStatement
object. @return one ofResultSet.TYPE_FORWARD_ONLY
ResultSet
.TYPE_SCROLL_INSENSITIVE orResultSet.TYPE_SCROLL_SENSITIVE
@since 1.2 @see What Is in the JDBC 2.0 API
Returns the current result as an update count; if the result is aClass Statement, SQLWarning getWarnings()ResultSet
object or there are no more results -1 is returned. This method should be called only once per result. @return the current result as an update count; -1 ifitthe current result is aResultSet
object or there are no more results @exception SQLException if a database access error occurs @see #execute
Retrieves the first warning reported by calls on thisClass Statement, void setCursorName(String)Statement
object. SubsequentStatement
object warnings will be chained to thisSQLWarning
object.The warning chain is automatically cleared each time a statement is (re)executed.
Note: If you are processing a
ResultSet
object any warnings associated with reads on thatResultSet
readsobject will be chained onthe ResultSet objectit. @return the firstSQLWarning
object ornull
@exception SQLException if a database access error occurs
Defines the SQL cursor name that will be used by subsequentClass Statement, void setEscapeProcessing(boolean)Statement
objectexecute
methods. This name can then be used in SQL positioned update/delete statements to identify the current row in theResultSet
object generated by this statement. If the database doesn't support positioned update/delete this method is a noop. To insure that a cursor has the proper isolation level to support updates the cursor'sSELECT
statement should be of the form 'select for update ...'. If the 'for update' phrase is omitted positioned updates may fail.Note: By definition positioned update/delete execution must be done by a different
Statement
object than the one which generated theResultSet
object being used for positioning. Also cursor names must be unique within a connection. @param name the new cursor name which must be unique within a connection @exception SQLException if a database access error occurs
Sets escape processing on or off. If escape scanning is on (the default) the driver will do escape substitution before sending the SQL to the database. Note: Since prepared statements have usually been parsed prior to making this call disabling escape processing for prepared statements will have no effect. @param enableClass Statement, void setFetchDirection(int)true
to enable;false
to disable @exception SQLException if a database access error occurs
Class Statement, void setFetchSize(int)JDBC 2.0Gives the driver a hint as to the direction in which the rows in a result set will be processed. The hint applies only to result sets created using thisStatement
object. The default value isResultSet.FETCH_FORWARD
.Note that this method sets the default fetch direction for result sets generated by this
Statement
object. Each result set has its own methods for getting and setting its own fetch direction. @param direction the initial direction for processing rows @exception SQLException if a database access error occurs or the given direction is not one ofResultSet.FETCH_FORWARD
ResultSet.FETCH_REVERSE
orResultSet.FETCH_UNKNOWN
@since 1.2 @see What Is in the JDBC 2.0 API
Class Statement, void setMaxFieldSize(int)JDBC 2.0Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. The number of rows specified affects only result sets created using this statement. If the value specified is zero then the hint is ignored. The default value is zero. @param rows the number of rows to fetch @exception SQLException if a database access error occurs or the condition 0 < rows < this.getMaxRows() is not satisfied. @since 1.2 @see What Is in the JDBC 2.0 API
Sets the limit for the maximum number of bytes in a column to the given number of bytes. This is the maximum number of bytes that can be returned for any column value. This limit applies only toClass Statement, void setMaxRows(int)BINARY
VARBINARY
LONGVARBINARY
CHAR
VARCHAR
andLONGVARCHAR
fields. If the limit is exceeded the excess data is silently discarded. For maximum portability use values greater than 256. @param max the new max column size limit; zero means unlimited @exception SQLException if a database access error occurs
Sets the limit for the maximum number of rows that any ResultSet
object can contain to the given number. If the limit is exceeded the excess rows are silently dropped. @param max the new max rows limit; zero means unlimited @exception SQLException if a database access error occurs
Class Statement, void setQueryTimeout(int)Sets the number of seconds the driver will wait for aStatement
object to execute to the given number of seconds. If the limit is exceededaanSQLException
is thrown. @param seconds the new query timeout limit in seconds; zero means unlimited @exception SQLException if a database access error occurs
Class Struct, Object[] getAttributes(Map)JDBC 2.0The standard mapping in the Java programming language for an SQL structured type. A
Struct
object contains a value for each attribute of the SQL structured type that it represents. By default an instance ofStruct
is valid as long as the application has a reference to it. @since 1.2 @see What Is in the JDBC 2.0 API
Produces the ordered values of the attributes of the SQL structurec type that thisStruct
object represents. This method uses the given type map for customizations of the type mappings. If there is no entry in the given type map that matches the structured type that thisStruct
object represents the driver uses the standard mapping. This method never uses the type map associated with the connection.Conceptually this method calls the method
getObject
on each attribute of the structured type and returns a Java array containing the result. @param map a mapping of SQL type names to Java classes @return an array containing the ordered attribute values @exception SQLException if a database access error occurs
Class Time, constructor Time(int, int, int)A thin wrapper around
java.util.Date
that allows JDBC to identify this as a SQLTIME
value. TheTime
class adds formatting and parsing operations to support the JDBC escape syntax for time values.The date components should be set to the "zero epoch" value of January 1 1970 and should not be accessed.
Constructs aClass Time, int getDate()Time
object initialized with the given values for the hour minute and second. The driver sets the date components to January 1 1970. Any method that attempts to access the date components of aTime
object will throw ajava.lang.IllegalArgumentException
. @param hour 0 to 23 @param minute 0 to 59 @param second 0 to 59 @deprecated Use the constructor that takes a milliseconds value in place of this constructor
This method is deprecated and should not be used because SQLClass Time, int getDay()TimeTIME
values do not have a date component. @deprecated @exception java.lang.IllegalArgumentException if this method is invoked
This method is deprecated and should not be used because SQLClass Time, int getMonth()TimeTIME
values do not have a day component. @deprecated @exception java.lang.IllegalArgumentException if this method is invoked
This method is deprecated and should not be used because SQLClass Time, int getYear()TimeTIME
values do not have a month component. @deprecated @exception java.lang.IllegalArgumentException if this method is invoked
This method is deprecated and should not be used because SQLClass Time, void setDate(int)TimeTIME
values do not have a year component. @deprecated @exception java.lang.IllegalArgumentException if this method is invoked
This method is deprecated and should not be used because SQLClass Time, void setMonth(int)TimeTIME
values do not have a date component. @deprecated @exception java.lang.IllegalArgumentException if this method is invoked
This method is deprecated and should not be used because SQLClass Time, void setYear(int)TimeTIME
values do not have a month component. @deprecated @exception java.lang.IllegalArgumentException if this method is invoked
This method is deprecated and should not be used because SQLClass Time, String toString()TimeTIME
values do not have a year component. @deprecated @exception java.lang.IllegalArgumentException if this method is invoked
FormatFormats a time in JDBC date escape format @return aString
in hh:mm:ss format
Class Timestamp, constructor Timestamp(int, int, int, int, int, int, int)
This class is aA thin wrapper aroundjava.util.Date
that allows the JDBC API to identify this asaan SQLTIMESTAMP
value. It adds the ability to hold the SQLTIMESTAMP
nanos value and provides formatting and parsing operations to support the JDBC escape syntax for timestamp values.Note: This type is a composite of a
java.util.Date
and a separatenanosnanoseconds value. Only integral seconds are stored in thejava.util.Date
component. The fractional seconds - the nanos - are separate. ThegetTime
method will return only integral seconds. If a time value that includes the fractional seconds is desired you must convert nanos to milliseconds (nanos/1000000) and add this to thegetTime
value. TheTimestamp.equals(Object)
method never returnstrue
when passed a value of typejava.util.Date
because the nanos component of a date is unknown. As a result theTimestamp.equals(Object)
method is not symmetric with respect to thejava.util.Date.equals(Object)
method. Also thehashcode
method uses the underlyingjava.util.Data
implementation and therefore does not include nanos in its computation. Due to the differences between theTimestamp
class and thejava.util.Date
class mentioned above it is recommended that code not viewTimestamp
values generically as an instance ofjava.util.Date
. The inheritance relationship betweenTimestamp
andjava.util.Date
really denotes implementation inheritance and not type inheritance.
Constructs aClass Timestamp, boolean after(Timestamp)Timestamp
object initialized with the given values. @param year year-1900 @param month 0 to 11 @paramdaydate 1 to 31 @param hour 0 to 23 @param minute 0 to 59 @param second 0 to 59 @param nano 0 to 999 999 999 @deprecated instead use the constructorTimestamp(long millis)
Indicates whether thisClass Timestamp, boolean before(Timestamp)Timestamp
object is later than the givenTimestamp
object.Is this timestamp later than the timestamp argument@param ts theTimestamp
value to compare with @returntrue
if thisTimestamp
object is later;false
otherwise
Indicates whether thisClass Timestamp, boolean equals(Object)Timestamp
object is earlier than the givenTimestamp
object. @param ts theTimestamp
value to compare with @returntrue
if thisTimestamp
object is earlier;false
otherwise
Tests to see if thisClass Timestamp, void setNanos(int)Timestamp
object is equal to the given object. This version of the methodequals
has been added to fix the incorrect signature ofTimestamp.equals(Timestamp)
and to preserve backward compatibility with existing class files. Note: This method is not symmetric with respect to theequals(Object)
method in the base class. @param ts theObject
value to compare with
Sets thisClass Timestamp, String toString()Timestamp
object'snanos
valuefield to the given value. @param n the new fractional seconds component @exception java.lang.IllegalArgumentException if the given argument is greater than 999999999 or less than 0
Formats a timestamp in JDBC timestamp escape format. @return aClass Timestamp, Timestamp valueOf(String)String
object inyyyy-mm-dd hh:mm:ss.fffffffff
format @overridestoString
in classjava.util.Date
Converts astringString
object in JDBC timestamp escape format to aTimestamp
value. @param s timestamp in formatyyyy-mm-dd hh:mm:ss.fffffffff
@return correspondingTimestamp
value @exception java.lang.IllegalArgumentException if the given argument does not have the formatyyyy-mm-dd hh:mm:ss.fffffffff
Class Types, int ARRAYThe class that defines the constants that are used to identify generic SQL types called JDBC types. The actual type constant values are equivalent to those in XOPEN.
This class is never instantiated.
Class Types, int BLOBJDBCThe2.0constant in the Java programming languageAsometimes referred to as a typerepresenting ancode that identifies the generic SQL typeARRAY. @since 1.2 @see What Is in the JDBC 2.0 API
Class Types, int CLOBJDBCThe2.0constant in the Java programmingAlanguage sometimes referred to as a typerepresentingcode that identifies theangeneric SQLBinarytypeBLOB
. @since 1.2 @seeLargeWhatObjectIs in the JDBC 2.0 API
Class Types, int DISTINCTJDBCThe2.0constant in the Java programmingAlanguage sometimes referred to as a typerepresentingcode that identifies theangeneric SQLCharactertypeCLOB
. @since 1.2 @seeLargeWhatObjectIs in the JDBC 2.0 API
Class Types, int JAVA_OBJECTJDBCThe2.0constantAintypethe Javabased onprogramming language sometimes referred to as abuilt-intype code that identifies the generic SQL typeDISTINCT
.One@since 1.2of@seetheWhattwoIsuser-definedindata typesthe JDBC(UDTs)2.0 API
Class Types, int OTHERJDBCThe2.0constantAintypethe Java programming language sometimesrepresentingreferred to as aJavatype code that identifies the genericObjectSQL typeJAVA_OBJECT
. @since 1.2 @see What Is in the JDBC 2.0 API
Class Types, int REFOTHERThe constant in the Java programming language that indicates that the SQL type is database-specific and gets mapped to a Java object that can be accessed via the methodsgetObject
andsetObject
.
Class Types, int STRUCTJDBCThe2.0constant in the Java programming languageAsometimes referred to as a typerepresenting ancode that identifies the generic SQL typeREF. @since 1.2 @see What Is in the JDBC 2.0 API
JDBCThe2.0constantAintypethe Java programming language sometimes referred to asconsisting of attributesa type code thatmayidentifies thebe anygeneric SQL typeSTRUCT
.One@sinceof1.2the@seetwoWhatuser-definedIsdataintypesthe JDBC(UDTs)2.0 API