JDBC Interfaces M-Z

This chapter describes the JDBC interfaces, and the Teradata-specific classes, that are supported by the Teradata JDBC Driver.

Note:  The following sections contain tables of the methods implemented by the Teradata JDBC Driver, with an indication of the level of support for the method by the Teradata JDBC Driver and the database. Each supported method is also described separately in detail.

ParameterMetaData Interface

Description

The ParameterMetadata methods provide a way to get information about the types and properties of the parameters in a PreparedStatement object.

Methods

Supported

getParameterClassName(int param)

Yes

getParameterCount()

Yes

getParameterType(int param)

Yes

getParameterMode(int param)

Yes

getParameterTypeName(int param)

Yes

getPrecision(int param)

Yes

getScale(int param)

Yes

isNullable(int param)

Yes

isSigned(int param)

Yes

Methods

getParameterCount()

Function: Retrieves the number of parameters in the PreparedStatement object for which this ParameterMetaData object contains information.

Characteristic

Description

Syntax

public int getParameterCount() throws SQLException

Return

The number of parameters is returned.

isNullable(int param)

Function: Retrieves whether null values are allowed in the designated parameter.

Characteristic

Description

Syntax

public int isNullable(int param) throws SQLException

where the param parameter is the parameter to check–the first parameter is 1, the second parameter is 2, and so on.

Return

The nullability status of the given parameter is returned; one of:

ParameterMetaData.parameterNoNulls ParameterMetaData.parameterNullable ParameterMetaData.parameterNullableUnknown.

isSigned(int param)

Function: Retrieves whether values for the designated parameter can be signed numbers.

Characteristic

Description

Syntax

public boolean isSigned(int param) throws SQLException

where the param parameter is the parameter to check–the first parameter is 1, the second parameter is 2, and so on.

Return

True, if so; False, otherwise

getPrecision(int param)

Function: Retrieves the designated parameter’s number of decimal digits.

Characteristic

Description

Syntax

public int getPrecision(int param) throws SQLException

where the param parameter is the parameter to check–the first parameter is 1, the second parameter is 2, and so on.

Return

precision. Zero is returned if precision is not applicable to the parameter

getScale(int param)

Function: Retrieves the designated parameter’s number of digits to the right of the decimal point.

Characteristic

Description

Syntax

public int getScale(int param) throws SQLException

where the param parameter is the parameter is check–the first parameter is 1, the second parameter is 2, and so on.

Return

scale. Zero is returned if scale is not applicable to the parameter.

getParameterType(int param)

Function: Retrieves the designated parameter’s SQL type.

Characteristic

Description

Syntax

public int getParameterType(int param) throws SQLException

where the param parameter is the parameter to check–the first parameter is 1, the second parameter is 2, and so on

Return

SQL type from java.sql.Types. java.sql.Types.NULL will be returned if the parameter type cannot be determined.

getParameterTypeName(int param)

Function: Retrieves the designated parameter’s database-specific type name.

Characteristic

Description

Syntax

public String getParameterTypeName(int param) throws SQLException

where the param parameter is the parameter to check–the first parameter is 1, the second parameter is 2, and so on.

Return

type, the name used by the database If the parameter type is a user-defined type, then a fully qualified type name is returned.

null is returned if the parameter typeName cannot be determined.

getParameterClassName(int param)

Function: Retrieves the fully qualified name of the Java class whose instances should be passed to the method PreparedStatement.setObject.

Characteristic

Description

Syntax

public String getParameterClassName(int param) throws SQLException

where the param parameter is the parameter to check–the first parameter is 1, the second is 2, and so on.

Return

The fully qualified name of the class in the Java programming language that would be used by the method PreparedStatement.setObject to set the value in the specified parameter is returned. This is the class name used for custom mapping.

null is returned if the Class name cannot be determined.

getParameterMode(int param)

Function: Retrieves the designated parameter’s mode.

Characteristic

Description

Syntax

public int getParameterMode(int param) throws SQLException

where the param parameter is the parameter to check–the first parameter is 1, the second is 2, and so on.

Return

Mode of the parameter is returned; one of:

ParameterMetaData.parameterModeIn ParameterMetaData.parameterModeInOut ParameterMetaData.parameterModeUnknown

PooledConnection Interface

Description

A PooledConnection object is a connection object that provides hooks for connection pool management. A PooledConnection object represents a physical connection to a data source.

Methods

Supported

addConnectionEventListener(ConnectionEventListener listener)

Yes

close()

Yes

getConnection()

Yes

removeConnectionEventListener(ConnectionEventListener listener)

Yes

Methods

addConnectionEventListener(ConnectionEventListener listener)

Function: Add an event listener. Registers the event listener so it will be notified whenever an event happens in the pool connection object.

Characteristic

Description

Syntax

public void addConnectionEventListener(ConnectionEventListener listener)

where the listener parameter is the object added as a listener to the event.

close()

Function: Close the physical connection

Characteristic

Description

Syntax

public void close() throws SQLException

getConnection()

Function: Create an object handle for the physical connection. The object returned is a temporary handle used by application code to refer to a physical connection that is being pooled.

Characteristic

Description

Syntax

public Connection getConnection() throws SQLException

Return

A Connection object, a handle to the pooled connection object is returned.

removeConnectionEventListener(ConnectionEventListener listener)

Function: Remove an event listener

Characteristic

Description

Syntax

public void removeConnectionEventListener(ConnectionEventListener listener)

where the listener parameter is the object removed from being a listener to the event.

PreparedStatement Interface

Description

A PreparedStatement is an object that represents a prepared SQL statement. A PreparedStatement can efficiently execute the prepared SQL statement multiple times.

Methods

Supported

addBatch()

Yes

clearParameters()

Yes

execute()

Yes

executeQuery()

Yes

executeUpdate()

Yes

getMetaData()

Yes

getParameterMetaData()

Yes

setArray(int i, Array x)

Yes

setAsciiStream(int parameterIndex, InputStream x, int length)

Yes

setBigDecimal(int parameterIndex, BigDecimal x)

Yes

setBinaryStream(int parameterIndex, InputStream x, int length)

Yes

setBlob(int i, Blob x)

Yes

setBoolean(int parameterIndex, boolean x)

Yes

setByte(int parameterIndex, byte x)

Yes

setBytes(int parameterIndex, byte[] x)

Yes

setCharacterStream(int parameterIndex, Reader reader, int length)

Yes

setClob(int i, Clob x)

Yes

setDate(int parameterIndex, Date x)

Yes

setDate(int parameterIndex, Date x, Calendar cal)

Yes

setDouble(int parameterIndex, Double x)

Yes

setFloat(int parameterIndex, float x)

Yes

setInt(int parameterIndex, int x)

Yes

setLong(int parameterIndex, long x)

Yes

setNull(int parameterIndex, int sqlType)

Yes

setNull(int paramIndex, int sqlType, String typeName)

Yes

setObject(int parameterIndex, Object x)

Yes

setObject(int parameterIndex, Object x, int targetSqlType)

Yes

setObject(int parameterIndex, Object x, int targetSqlType, int scale)

Yes

setRef(int i, Ref x)

No

setShort(int parameterIndex, Short x)

Yes

setSQLXML(int parameterIndex, SQLXML x)

Yes

setString(int parameterIndex, String x)

Yes

setTime(int parameterIndex, Time x)

Yes

setTime(int parameterIndex, Time x, Calendar cal)

Yes

setTimestamp(int parameterIndex, Timestamp x)

Yes

setTimestamp(int parameterIndex, Timestamp x, Calendar cal)

Yes

setUnicodeStream(int parameterIndex, InputStream x, int length) [DEPRECATED]

Yes

Methods

The following subsections provide a brief description of each supported PreparedStatement method.

addBatch()

Function: This method adds a set of parameters to the PreparedStatement object’s batch of commands.

Characteristic

Description

Syntax

public void addBatch() throws SQLException

 

Note:  It is recommended to use this method with auto-commit disabled.

clearParameters()

Function: Clears the current parameter values immediately

Characteristic

Description

Syntax

public void clearParameters() throws SQLException

Note:  In general, parameter values remain in force for repeated use of a Statement.

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 clearParameters.

execute()

Function: Executes any kind of SQL statement

Characteristic

Description

Syntax

public boolean execute() throws SQLException

Note:  Some prepared statements return multiple results. The execute method handles these complex statements as well as the simple form of statement handled by the executeQuery and executeUpdate methods.

executeQuery()

Function: Executes the SQL query in the PreparedStatement object

Characteristic

Description

Syntax

public ResultSet executeQuery() throws SQLException

Return

The ResultSet that contains the date produced by the query is returned. If used inappropriately, returns an exception according to the JDBC standard.

Note:  The ResultSet is never null.

An exception is returned if used to execute a statement that does not return a result set.

The error is 1077 “executeQuery() cannot be used when there is no result set expected; use executeUpdate() or execute()”.

An exception is returned if the request contains multiple statements.

The error is 1079 “% executeQuery() cannot be used when the request contains multiple statements; use execute()”.

executeUpdate()

Function: Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object.

Characteristic

Description

Syntax

public int executeUpdate() throws SQLException

Return

Either the row count for INSERT, UPDATE, or DELETE statements, or 0 for SQL statements that return nothing. If used inappropriately, returns an exception according to the JDBC standard.

Note:  The executeUpdate objects can also execute SQL statements that return nothing, such as DDL statements.

An exception is returned if used to execute a statement that returns a result set.

The error is 1078 “executeUpdate() cannot be used when a result set is expected; use executeQuery() or execute()”.

An exception is returned if the request contains multiple statements.

The error is 1079 “% executeUpdate() cannot be used when the request contains multiple statements; use execute()”.

Beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.25, for row count values received from the database that are too large to fit into a signed 32-bit integer, the Teradata JDBC Driver will return an update count of Integer.MAX_VALUE to the application, and will provide a SQLWarning with error code 1474 that lists the actual row count in the message text.

getMetaData()

Function: Retrieves the number, types, and properties of a ResultSet object’s columns

Characteristic

Description

Syntax

public ResultSetMetaData getMetaData() throws SQLException

Return

The description of a ResultSet’s columns is returned.

getParameterMetaData()

Function: Retrieves the number, types, and properties of this PreparedStatement object’s parameters.

Characteristic

Description

Syntax

public ParameterMetaData getParameterMetaData() throws SQLException

Return

A ParameterMetaData object is returned. An exception is thrown if ParameterMetaData is not available.

setArray(int parameterIndex, Array x)

Function: Sets the designated parameter to the given java.sql.Array object

Characteristic

Description

Syntax

public void setArray(int parameterIndex, Array x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification. The first parameter is 1, the second parameter is 2, and so on
  • x is an Array object that maps an SQL ARRAY value

Note:  This method is available beginning with Teradata Database 14.0 and Teradata JDBC Driver 14.00.00.04.

setAsciiStream(int parameterIndex, InputStream x, int length)

Function: Sets the designated parameter to the given input stream, which will have the specified number of bytes

Characteristic

Description

Syntax

public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification. The first parameter is 1, the second parameter is 2, and so on
  • x is the Java input stream that contains the ASCII parameter value
  • length is the number of bytes in the stream

Note:  When a very large ASCII value is input to a LONGVARCHAR parameter, it may be more practical to send it using a java.io.InputStream.

JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from ASCII to the database char format.

This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

setBigDecimal(int parameterIndex, BigDecimal x)

Function: Sets the designated parameter to a java.math.BigDecimal value. The driver converts this to an SQL NUMERIC value when it sends it to the database.

Characteristic

Description

Syntax

public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification. The first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

Note:  Beginning with Teradata Database 14.0 and Teradata JDBC Driver 14.00.00.09, the Teradata JDBC Driver sends the BigDecimal value to the database as the SQL NUMBER data type. With prior software versions, the Teradata JDBC Driver sends the BigDecimal value to the database as the SQL DECIMAL data type.

setBinaryStream(int parameterIndex, InputStream x, int length)

Function: Sets the designated parameter to the given input stream, which will have the specified number of bytes

Characteristic

Description

Syntax

public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification. The first parameter is 1, the second parameter is 2, and so on
  • x is the Java input stream that contains the binary parameter value
  • length is the number of bytes in the stream

Note:  When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it using a java.io.InputStream.

JDBC will read the data from the stream as needed, until it reaches end-of-file.

This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

setBlob(int i, Blob x)

Function: Sets the parameter number to a Blob object

Characteristic

Description

Syntax

public void setBlob(int i, Blob x) throws SQLException

where the parameter:

  • i is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is a BLOB object that maps an SQL BLOB value

setBoolean(int parameterIndex, boolean x)

Function: Sets the designated parameter to a Java boolean value. The driver converts this to an SQL BIT value and sends it to the database.

Characteristic

Description

 

public void setBoolean(int parameterIndex, boolean x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setByte(int parameterIndex, byte x)

Function: Sets the designated parameter to a Java byte value. The driver converts this to an SQL TINYINT value and sends it to the database.

Characteristic

Description

Syntax

public void setByte(int parameterIndex, byte x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setBytes(int parameterIndex, byte[ ] x)

Function: Sets the designated parameter to a Java array of bytes. The driver converts this to an SQL VARBINARY or LONGVARBINARY (depending on the size of the argument size relative to the VARBINARY limits of the driver), and sends it to the database.

Characteristic

Description

Syntax

public void setBytes(int parameterIndex, byte[] x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setCharacterStream(int parameterIndex, Reader reader, int length)

Function: Sets the designated parameter to the given Reader object, which is the given number of characters long

Characteristic

Description

Syntax

public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • reader is the java reader that contains the UNICODE data
  • length is the number of characters in the stream

Note:  When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it using a java.io.Reader. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from UNICODE to the database char format.

This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

setClob(int i, Clob x)

Function: Sets the parameter number in a CLOB object

Characteristic

Description

Syntax

public void setClob(int i, Clob x) throws SQLException

where the parameter:

  • i is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is a CLOB object that maps an SQL CLOB value

setDate(int parameterIndex, Date x)

Function: Sets the designated parameter to a java.sql.Date value. The driver converts this to an SQL DATE value and sends it to the database.

Characteristic

Description

Syntax

public void setDate(int parameterIndex, Date x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setDate(int parameterIndex, Date x, Calendar cal)

Function: Sets the designated parameter to a java.sql.Date value, using the given Calendar object

Characteristic

Description

Syntax

public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value
  • cal is the Calendar object the driver will use to construct the date

Note:  With a Calendar object, the driver can calculate the date taking into account a custom timezone and locale.

If no Calendar object is specified, the driver uses the default timezone and locale.

The driver ignores the Calendar object since the Teradata Database does not support time zones for dates.

setDouble(int parameterIndex, double x)

Function: Sets the designated parameter to a Java double value. The driver converts this to an SQL DOUBLE value and sends it to the database.

Characteristic

Description

Syntax

public void setDouble(int parameterIndex, double x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setFloat(int parameterIndex, float x)

Function: Sets the designated parameter to a Java float value. The driver converts this to an SQL FLOAT value and sends it to the database.

Characteristic

Description

Syntax

public void setFloat(int parameterIndex, float x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setInt(int parameterIndex, int x)

Function: Sets the designated parameter to a Java int value. The driver converts this to an SQL INTEGER value and sends it to the database.

Characteristic

Description

Syntax

public void setInt(int parameterIndex, int x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setLong(int parameterIndex, long x)

Function: Sets the designated parameter to a Java long value. The driver converts this to an SQL BIGINT value and sends it to the database.

Characteristic

Description

Syntax

public void setLong(int parameterIndex, long x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setNull(int parameterIndex, int sqlType)

Function: Sets the designated parameter to SQL NULL.

Characteristic

Description

Syntax

public void setNull(int parameterIndex, int sqlType) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • sqlType is the SQL type code defined in java.sql.Types

Note:  You must specify the sqlType parameter.

Null Expressions: If any expression in a comparison is null, the result of the comparison is unknown. For a comparison to provide a TRUE result when comparing fields that might result in nulls, the statement must include the IS (NOT) NULL operator.

setNull(int paramIndex, int sqlType, String typeName)

Function: Sets the designated parameter to SQL NULL.

Use this version of setNull for user-named types and REF-type parameters.

Examples of user-named types include:

Characteristic

Description

Syntax

public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • sqlType is the SQL type code defined in java.sql.Types
  • typeName is the fully qualified name of an SQL user-named type, ignored if the parameter is not a user-named type or REF

Note:  To be portable, applications must give the SQL type code and the fully qualified SQL name when specifying a NULL user-defined or REF parameter.

Null Expressions: If any expression in a comparison is null, the result of the comparison is unknown. For a comparison to provide a TRUE result when comparing fields that might result in nulls, the statement must include the IS [NOT] NULL operator.

In the case of a user-named type, the name is the type name of the parameter itself.

If a JDBC driver does not need the type code or type name information, it may ignore it. Although it is intended for user-named 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-named or REF type, the given typeName is ignored.

setObject(int parameterIndex, Object x)

Function: Sets the value of a parameter using an object. Use the java.lang equivalent objects for integral values.

Characteristic

Description

Syntax

public void setObject(int parameterIndex, Object x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the object containing the input parameter value

Note:  The JDBC specification specifies a standard mapping from Java Object types to SQL types. The given argument java object will be converted to the corresponding SQL type before being sent to the database.

Note that this method may be used to pass database specific abstract data types, by using a Driver-specific java type.

If the object is of a class implementing SQLData, the JDBC driver should call its method 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 of those interfaces.

setObject(int parameterIndex, Object x, int targetSqlType)

Function: Sets the value of the designated parameter with the given object. This method is like the preceding setObject method, except that it assumes a scale of zero.

Characteristic

Description

Syntax

public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the object containing the input parameter value
  • targetSqlType is the SQL type (as defined in java.sql.Types) to be sent to the database

setObject(int parameterIndex, Object x, int targetSqlType, int scale)

Function: Sets the value of a parameter using an object

The second argument must be an object type. For integral values, the java.lang equivalent objects should be used.

Characteristic

Description

Syntax

public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the object containing the input parameter value
  • targetSqlType is the SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.
  • scale is the number of digits after the decimal point–for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types. For all other types, this value is ignored.

Note:  The given Java object will be converted to the targetSqlType before being sent to the database.

If the object has a custom mapping (is of a class implementing SQLData), the JDBC driver should call its method 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.

This method may be used to pass database-specific abstract data types.

setShort(int parameterIndex, short x)

Function: Sets the designated parameter to a Java short value.

Characteristic

Description

Syntax

public void setShort(int parameterIndex, short x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setSQLXML(int parameterIndex, SQLXML x)

Function: Sets the designated parameter to the given java.sql.SQLXML object.

Characteristic

Description

Syntax

public void setSQLXML(int parameterIndex, SQLXML x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

setString(int parameterIndex, String x)

Function: Sets the designated parameter in a Java String value.

The driver converts this to an SQL VARCHAR or LONGVARCHAR value (depending on the size of the argument size relative to VARCHAR limits of the driver), and sends it to the database.

Characteristic

Description

Syntax

public void setString(int parameterIndex, String x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setTime(int parameterIndex, Time x)

Function: Sets the designated parameter to a java.sql.Time value.

The driver converts this to an SQL TIME value when it sends it to the database.

Characteristic

Description

Syntax

public void setTime(int parameterIndex, Time x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setTime(int parameterIndex, Time x, Calendar cal)

Function: Sets the designated parameter to a java.sql.Time value, using the given Calendar object.

Characteristic

Description

Syntax

public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value
  • cal is the Calendar object the driver will use to construct the time

Note:  The driver uses the Calendar object to construct an SQL TIME, which the driver then sends to the database.

With a Calendar object, the driver can calculate the time taking into account a custom timezone and locale.

If no Calendar object is specified, the driver uses the default timezone and locale.

setTimestamp(int parameterIndex, Timestamp x)

Function: Sets the designated parameter to a java.sql.Timestamp value

The driver converts this to an SQL TIMESTAMP value when it sends it to the database.

Characteristic

Description

Syntax

public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value

setTimestamp(int parameterIndex, Timestamp x, Calendar cal)

Function: Sets the designated parameter to a java.sql.Timestamp value, using the given Calendar object.

Characteristic

Description

Syntax

public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the parameter value
  • cal is the Calendar object the driver will use to construct the time

Note:  The driver uses the Calendar object to construct an SQL TIMESTAMP, which the driver then sends to the database.

With a Calendar object, the driver can calculate the timestamp taking into account a custom timezone and locale.

If no Calendar object is specified, the driver uses the default timezone and locale.

setUnicodeStream(int parameterIndex, InputStream x, int length)

Function: [DEPRECATED] Sets the designated parameter to the input stream specified by x. Data is read from the stream until EOF.

The format of the input stream must be UTF-8.

Characteristic

Description

Syntax

public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException

where the parameter:

  • parameterIndex is the parameter specification; the first parameter is 1, the second parameter is 2, and so on
  • x is the java input stream containing the UNICODE parameter value
  • length is the bytes in the input stream

ResultSet Interface

Description

A ResultSet provides access to a table of data generated by executing a Statement. The table rows are retrieved in sequence. Within a row its column values can be accessed in any order.

A ResultSet 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.

A default ResultSet object is not updatable and has a cursor that moves forward only. As a result, you can iterate through it only once and only from the first row to the last row. It is possible to produce ResultSet objects that are scrollable and/or updatable.

The getXXX methods retrieve column values for the current row. Retrieve values either using the index number of the column, or by using the name of the column. In general, using the column index is more efficient. Columns numbering begins at 1.

For maximum portability, read ResultSet columns within each row in left-to-right order and read each column only once.

For the getXXX methods, the Teradata JDBC Driver attempts to convert the underlying data to the specified Java type and returns a suitable Java value. See the JDBC specification for allowable mappings from SQL types to Java types with the ResultSet.getXXX methods.

Column names used as input to getXXX methods are case-insensitive. When performing a getXXX using a column name, if several columns have the same name, then the value of the first matching column is returned.

A set of updater methods was added to this interface in the JDBC 2.0 API (JDK 1.2). The comments regarding parameters to the getter methods also apply to parameters to the updater methods.

A ResultSet is automatically closed by the Statement that generated it when that Statement is closed, re-executed, or used to retrieve the next result from a sequence of multiple results.

The ResultSetMetaData object returned by the getMetaData method provides the number, types, and properties of a ResultSet’s columns.

Methods

Supported

absolute(int row)

Yes

afterLast()

Yes

beforeFirst()

Yes

cancelRowUpdates()

Yes

clearWarnings()

Yes

close()

Yes

deleteRow()

Yes

findColumn(String columnName)

Yes

first()

Yes

getArray(int columnIndex)

Yes

getArray(String columnName)

Yes

getAsciiStream(int columnIndex)

Yes

getAsciiStream(String columnName)

Yes

getBigDecimal(int columnIndex)

Yes

getBigDecimal(int columnIndex, int scale) [Deprecated]

Yes

getBigDecimal(String columnName)

Yes

getBigDecimal(String columnName, int scale) [Deprecated]

Yes

getBinaryStream(int columnIndex)

Yes

getBinaryStream(String columnName)

Yes

getBlob(int i)

Yes

getBlob(String columnName)

Yes

getBoolean(int columnIndex)

Yes

getBoolean(String columnName)

Yes

getByte(int columnIndex)

Yes

getByte(String columnName)

Yes

getBytes(int columnIndex)

Yes

getBytes(String columnName)

Yes

getCharacterStream(int columnIndex)

Yes

getCharacterStream(String columnName)

Yes

getClob(int i)

Yes

getClob(String columnName)

Yes

getConcurrency()

Yes

getCursorName()

No

getDate(int columnIndex)

Yes

getDate(String columnName)

Yes

getDate(int columnIndex, Calendar cal)

Yes

getDate(String columnName, Calendar cal)

Yes

getDouble(int columnIndex)

Yes

getDouble(String columnName)

Yes

getFetchDirection()

Yes

getFetchSize()

Yes

getFloat(int columnIndex)

Yes

getFloat(String columnName)

Yes

getHoldability()

Yes

getInt(int columnIndex)

Yes

getInt(String columnName)

Yes

getLong(int columnIndex)

Yes

getLong(String columnName)

Yes

getMetaData()

Yes

getObject(int columnIndex)

Yes

getObject(int i, Map map)

Yes

getObject(String columnName)

Yes

getObject(String columnName, Map map)

Yes

getRef(int i)

No

getRef(String columnName)

No

getRow()

Yes

getShort(int columnIndex)

Yes

getShort(String columnName)

Yes

getSQLXML(int columnIndex)

Yes

getSQLXML(String columnName)

Yes

getStatement()

Yes

getString(int columnIndex)

Yes

getString(String columnName)

Yes

getTime(int columnIndex)

Yes

getTime(int columnIndex, Calendar cal)

Yes

getTime(String columnName)

Yes

getTime(String columnName, Calendar cal)

Yes

getTimeStamp(int columnIndex)

Yes

getTimeStamp(int columnIndex, Calendar cal)

Yes

getTimeStamp(String columnName)

Yes

getTimeStamp(String columnName, Calendar cal)

Yes

getType()

Yes

getUnicodeStream(int columnIndex)[Deprecated]

Yes

getUnicodeStream(String columnName)[Deprecated]

Yes

getWarnings()

Yes

insertRow()

Yes

isAfterLast()

Yes

isBeforeFirst()

Yes

isFirst()

Yes

isLast()

Yes

last()

Yes

moveToCurrentRow()

Yes

moveToInsertRow()

Yes

next()

Yes

previous()

Yes

refreshRow()

Yes

relative(int rows)

Yes

rowDeleted()

Yes

rowInserted()

Yes

rowUpdated()

Yes

setFetchDirection(int direction)

Yes*

setFetchSize(int rows)

Yes

updateArray(int columnIndex, Array x)

No

updateArray(String columnName, Array x)

No

updateAsciiStream(int columnIndex, InputStream x, int length)

Yes

updateAsciiStream(String columnName, InputStream x, int length)

Yes

updateBigDecimal(int columnIndex, BigDecimal x)

Yes

updateBigDecimal(String columnName, BigDecimal x)

Yes

updateBinaryStream(int columnIndex, InputStream x, int length)

Yes

updateBinaryStream(String columnName, InputStream x, int length)

Yes

updateBlob(int columnIndex, Blob x)

Yes

updateBlob(String columnName, Blob x)

Yes

updateBoolean(int columnIndex, boolean x)

No

updateBoolean(String columnName, boolean x)

No

updateByte(int columnIndex, byte x)

Yes

updateByte(String columnName, byte x)

Yes

updateBytes(int columnIndex, byte[] x)

Yes

updateBytes(String columnName, byte[] x)

Yes

updateCharacterStream(int columnIndex, Reader x, int length)

Yes

updateCharacterStream(String columnName, Reader x, int length)

Yes

updateClob(int columnIndex, Clob x)

Yes

updateClob(String columnName, Clob x)

Yes

updateDate(int columnIndex, Date x)

Yes

updateDate(String columnName, Date x)

Yes

updateDouble(int columnIndex, double x)

Yes

updateDouble(String columnName, double x)

Yes

updateFloat(int columnIndex, float x)

Yes

updateFloat(String columnName, float x)

Yes

updateInt(int columnIndex, int x)

Yes

updateInt(String columnName, int x)

Yes

updateLong(int columnIndex, long x)

Yes

updateLong(String columnName, long x)

Yes

updateNull(int columnIndex)

Yes

updateNull(String columnName)

Yes

updateObject(int columnIndex, Object x)

Yes

updateObject(int columnIndex, Object x, int scale)

Yes

updateObject(String columnName, Object x)

Yes

updateObject(String columnName, Object x, int scale)

Yes

updateRef(int columnIndex, Ref x)

No

updateRef(String columnName, Ref x)

No

updateRow()

Yes

updateShort(int columnIndex, short x)

Yes

updateShort(String columnName, short x)

Yes

updateSQLXML(int columnIndex, SQLXML x)

Yes

updateSQLXML(String columnName, SQLXML x)

Yes

updateString(int columnIndex, String x)

Yes

updateString(String columnName, String x)

Yes

updateTime(int columnIndex, Time x)

Yes

updateTime(String columnName, Time x)

Yes

updateTimestamp(int columnIndex, Timestamp x)

Yes

updateTimestamp(String columnName, Timestamp x)

Yes

wasNull()

Yes

Methods

The following subsections provide a brief description of each supported ResultSet method.

absolute(int row)

Function: The cursor is moved to the row number in the ResultSet object.

Characteristic

Description

Syntax

public int absolute(int row) throws SQLException

where the row parameter contains the number of the row where the cursor should move. If the row number is positive, the cursor moves in relation to the first row. If the row number is negative, the cursor position moves in relation to the last row.

Result

True, if the cursor is located on the ResultSet

False, if it is not

Note:  Throws the SQLException if a database access error occurs, or if the ResultSetType is TYPE_FORWARD_ONLY.

A call absolute(1) is the same as calling first()

A call absolute(-1) is the same as calling last()

afterLast()

Function: The cursor is moved to just after the last row of the ResultSet object.

Characteristic

Description

Syntax

public void afterLast() throws SQLException

Note:  If the ResultSet contains no rows, this method has no effect.

Throws the SQLException if a database access error occurs, or if the ResultSetType is TYPE_FORWARD_ONLY.

beforeFirst()

Function: The cursor is moved to just before the first row of the ResultSet object.

Characteristic

Description

Syntax

public void beforeFirst() throws SQLException

Note:  If the ResultSet contains no rows, this method has no effect.

Throws the SQLException if a database access error occurs, or if the ResultSetType is TYPE_FORWARD_ONLY.

cancelRowUpdates()

Function: Cancels the updates made to the current row in this ResultSet object. This method may be called after calling an updater method(s) and before calling the method updateRow to roll back the updates made to a row. If no updates have been made or updateRow has already been called, this method has no effect.

Character

Description

Syntax

public void cancelRowUpdate() throws SQLException

Note:  Throws the SQLException if a database access error occurs or if this method is called when the cursor is on the insert row.

clearWarnings()

Function: Clears all warnings reported on this ResultSet object. After this call, getWarnings returns null until a new warning is reported for this ResultSet.

Characteristic

Description

Syntax

public void clearWarnings() throws SQLException

close()

In some cases, it is desirable to immediately release a ResultSet’s database and JDBC resources instead of waiting for this to happen when it is automatically closed. The close method provides this immediate release.

Characteristic

Description

Syntax

public void close() throws SQLException

Note:  A ResultSet is automatically closed by the statement that generated it when that statement is closed, re-executed, or used to retrieve the next result from a sequence of multiple results. A ResultSet is also automatically closed when it is garbage collected.

deleteRow()

Function: Deletes the current row from this ResultSet object and from the underlying database. This method cannot be called when the cursor is on the insert row.

Characteristic

Description

Syntax

public void deleteRow() throws SQLException

Note:  Throws the SQLException if a database access error occurs or if this method is called when the cursor is on the insert row

findColumn(String columnName)

Function: Maps a Resultset column name to a ResultSet column index.

Characteristic

Description

Syntax

public int findColumn(String columnName) throws SQLException

where the columnName parameter is the name of the column

Return

The column index of columnName is returned.

first()

Function: Moves the cursor to the ResultSet object first row.

Characteristic

Description

Syntax

public boolean first() throws SQLException

Return

True, if the location of the cursor is a valid row

False, if there are no rows in the ResultSet

Note:  Throws the SQLException if a database access error occurs, or if the ResultSetType is TYPE_FORWARD_ONLY.

getArray(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row of this ResultSet object as an Array object.

Characteristic

Description

Syntax

public Array getArray(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

An Array object representing the SQL ARRAY value in the specified column. If the value is SQL NULL, then the result is null.

Note:  This method is available beginning with Teradata Database 14.0 and Teradata JDBC Driver 14.00.00.04.

getArray(String columnName)

Function: Gets the value of a column designated by columnName in the current row of this ResultSet object as an Array object.

Characteristic

Description

Syntax

public Array getArray(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

An Array object representing the SQL ARRAY value in the specified column. If the value is SQL NULL, then the result is null.

Note:  This method is available beginning with Teradata Database 14.0 and Teradata JDBC Driver 14.00.00.04.

getAsciiStream(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row of this ResultSet object as a stream of ASCII characters. The value can then be read in chunks from the stream.

Characteristic

Description

Syntax

public InputStream getAsciiStream(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

A Java input stream that delivers the database column value as a stream of one-byte ASCII characters. If the value is SQL NULL, then the result is null.

Note:  This method is particularly suitable for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the database format into ASCII.

All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Also, a stream may return 0 when the method available is called whether there is data available or not.

getAsciiStream(String columnName)

Function: Gets the value of a column in the current row of this ResultSet object as a stream of ASCII characters. The value can then be read in chunks from the stream.

Characteristic

Description

Syntax

public InputStream getAsciiStream(String columnName) throws SQLException

where the columnName parameter is 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.

Note:  This method is particularly suitable for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the database format into ASCII.

If the value is SQL NULL then the result is null.

All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Also, a stream may return 0 when the method available is called whether there is data available or not.

getBigDecimal(int columnIndex)

Function: Gets the value of the column designated by columnIndex in the current row of this ResultSet object as a java.math.BigDecimal with full precision.

Characteristic

Description

Syntax

public BigDecimal getBigDecimal(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The column value is returned.

Note:  If the value is sQL NULL, the result is NULL.

Note:  If the value is sQL NULL, the result is NULL.

getBigDecimal(int columnIndex, int scale)

Function: Gets the value of the column designated by columnIndex in the current row of this ResultSet object as a java.sql.BigDecimal with full precision.

Characteristic

Description

Syntax

public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException

where the parameter:

  • columnIndex is the column specification; the first column is 1, the second column is 2, and so on
  • scale is the number of digits to the right of the decimal point

Return

If the value is SQL NULL, the result is NULL.

getBigDecimal(String columnName)

Function: Gets the value of a column designated by columnName in the current row of this ResultSet object as a java.math.BigDecimal with full precision.

Characteristic

Description

Syntax

public BigDecimal getBigDecimal(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The column value is returned.

Note:  If the value is SQL NULL, the result is NULL.

getBigDecimal(String columnName, int scale)

Function: Gets the value of a column designated by columnName in the current row of this ResultSet object as a java.math.BigDecimal.

Characteristic

Description

Syntax

public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException

where the parameter:

  • columnName is the SQL name of the column
  • scale is the number of digits to the right of the decimal point

Return

The column value is returned.

Note:  If the value is SQL NULL, the result is NULL.

getBinaryStream(int columnIndex)

Function: Gets the column value designated by columnIndex as a stream of uninterpreted bytes and read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARBINARY values.

Characteristic

Description

Syntax

public InputStream getBinaryStream(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

A Java input stream that delivers the database column value as a stream of uninterpreted bytes is returned.

Note:  If the value is SQL NULL, then the result is null.

All the data in the returned stream must be read before getting the value of any other column. The next call to a get method implicitly closes the stream. Also, a stream may return zero for available() whether data is available or not.

getBinaryStream(String columnName)

Function: Gets the column value designated by columnName as a stream of uninterpreted bytes and read in chunks from the stream.

Characteristic

Description

Syntax

public InputStream getBinaryStream(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

A Java input stream that delivers the database column value as a stream of uninterpreted bytes is returned. If the value is SQL NULL, then the result is null.

Note:  This method is particularly suitable for retrieving large LONGVARBINARY values.

All the data in the returned stream must be read before getting the value of any other column. The next call to a get method implicitly closes the stream. Also, a stream may return zero for available() whether data is available or not.

getBlob(int i)

Function: Returns the value of the designated column in the current row of this ResultSet object as a Blob object in the Java programming language.

Characteristic

Description

Syntax

public Blob getBlob(int i) throws SQLException

where the i parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

Returns a Blob object representing the SQL BLOB value in the specified column.

getBlob(String colName)

Function: Returns the value of the designated column in the current row of this ResultSet object as a Blob object in the Java programming language.

Characteristic

Description

Syntax

public Blob getBlob(String colName) throws SQLException

where the colName parameter is the name of the column from which to retrieve the value

Return

Returns a Blob object representing the SQL BLOB value in the specified column.

getBoolean(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row of the ResultSet as a Java boolean.

Characteristic

Description

Syntax

public boolean getBoolean(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the value is SQL NULL, the result is false.

getBoolean(String columnName)

Function: Gets the value of a column designated by columnName in the current row of the ResultSet as a Java boolean.

Characteristic

Description

Syntax

public boolean getBoolean(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the value is SQL NULL, the result is false.

getByte(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row as a Java byte.

Characteristic

Description

Syntax

public byte getByte(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the value is SQL NULL, the result is 0.

getByte(String columnName)

Function: Gets the value of a column designated by columnName in the current row as a Java byte.

Characteristic

Description

Syntax

public byte getByte(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the value is SQL NULL, the result is 0.

getBytes(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row as a Java byte array.

Characteristic

Description

Syntax

public byte[] getBytes(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the value is SQL NULL, the result is null.

getBytes(String columnName)

Function: Gets the value of a column designated by columnName in the current row as a Java byte array.

Characteristic

Description

Syntax

public byte[] getBytes(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the value is SQL NULL, the result is null.

getCharacterStream(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row as a java.io.Reader.

Characteristic

Description

Syntax

public Reader getCharacterStream(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value in the specified column as a java.io.Reader is returned.

Note:  If the column value returned is SQL NULL, the result is null.

getCharacterStream(String columnName)

Function: Gets the value of a column designated by columnName in the current row as a java.io.Reader.

Characteristic

Description

Syntax

public Reader getCharacterStream(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value in the specified column as a java.io.Reader is returned.

Note:  If the column value returned is SQL NULL, the result is null.

getClob(int i)

Function: Returns the value of the designated column in the current row of this ResultSet object as a Clob object in the Java programming language.

Characteristic

Description

Syntax

public Clob getClob(int i) throws SQLException

where the i parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

Returns a Clob object representing the SQL CLOB value in the specified column.

getClob(String colName)

Function: Returns the value of the designated column in the current row of this ResultSet object as a Clob object in the Java programming language.

Characteristic

Description

Syntax

public Blob getClob(String colName) throws SQLException

where the colName parameter is the name of the column from which to retrieve the value

Return

Returns a Clob object representing the SQL CLOB value in the specified column.

getConcurrency()

Function: Retrieves the concurrency mode of this ResultSet object. The concurrency used is determined by the Statement object that created the result set.

Characteristic

Description

Syntax

public int getConcurrency() throws SQLException

Return

The concurrency type is returned, either ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE

Note:  Throws the SQLException if a database access error occurs.

getDate(String columnIndex)

Function: Gets the value of the column designated by columnIndex in the current row of the ResultSet object as a java.sql.Date object.

Characteristic

Return

Syntax

public Date getDate(String columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

getDate(String columnName)

Function: Gets the value of the column designated by columnName in the current row of the ResultSet object as a java.sql.Date object.

Characteristic

Description

Syntax

public Date getDate(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

getDate(String columnIndex, Calendar cal)

Function: Gets the value of the column designated by columnIndex in the current row of the ResultSet object as a java.sql.Date object.

Characteristic

Description

Syntax

public Date getDate(String columnIndex, Calendar cal) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so on
  • cal is the calendar to use in constructing the date

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

This method uses the given calendar to construct an appropriate millisecond value for the Date, if the underlying database does not store timezone information.

The time zone is ignored since the database does not support time zones with dates.

getDate(String columnName, Calendar cal)

Function: Gets the value of the column designated by columnName in the current row of the ResultSet object as a java.sql.Date object.

Characteristic

Description

Syntax

public Date getDate(String columnName, Calendar cal) throws SQLException

where the parameter:

  • columnName is the SQL name of the column from which to retrieve the value
  • cal is the calendar to use in constructing the date

Return

The column value as a java.sql.Date.object is returned.

Note:  If the column value returned is SQL NULL, the result is null.

This method uses the given calendar to construct an appropriate millisecond value for the Date, if the underlying database does not store timezone information.

The time zone is ignored since the database does not support time zones with dates.

getDouble(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row as a Java double.

Characteristic

Description

Syntax

public double getDouble(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is 0.

getDouble(String columnName)

Function: Gets the value of the column designated by columnName in the current row of this ResultSet as a Java double.

Characteristic

Description

Syntax

public double getDouble(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is 0.

getFetchDirection()

Function: Gets the fetch direction of the ResultSet.

Characteristic

Description

Syntax

public float getFetchDirection() throws SQLException

Return

The current fetch direction for the ResultSet is returned.

getFetchSize()

Function: Gets the fetch size of the ResultSet.

Characteristic

Description

Syntax

public int getFetchSize() throws SQLException

Return

The current fetch size for the ResultSet is returned.

getFloat(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row of this ResultSet object as a Java float.

Characteristic

Description

Syntax

public float getFloat(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is 0.

getFloat(String columnName)

Function: Gets the value of a column designated by columnName in the current row of this ResultSet as a Java float.

Characteristic

Description

Syntax

public float getFloat(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is 0.

getHoldability()

Function: Gets the holdability of this ResultSet.

Characteristic

Description

Syntax

public int getHoldability() throws SQLException

Return

ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT

Note:   ResultSet.CLOSE_CURSORS_AT_COMMIT is supported beginning with Teradata JDBC Driver 14.00.00.28. Earlier versions of the Teradata JDBC Driver supported only ResultSet.HOLD_CURSORS_OVER_COMMIT.

getInt(int columnIndex)

Function: Gets the value of the column designated by columnIndex in the current row of this ResultSet as a Java int.

Characteristic

Description

Syntax

public int getInt(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is 0.

getInt(String columnName)

Function: Gets the value of a column designated by columnName in the current row of this ResultSet as a Java int.

Characteristic

Description

Syntax

public int getInt(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is 0.

getLong(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row of this ResultSet as a Java long.

Characteristic

Description

Syntax

public long getLong(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is 0.

getLong(String columnName)

Function: Gets the value of a column designated by columnName in the current row of this ResultSet as a Java long.

Characteristic

Description

Syntax

public long getLong(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is 0.

getMetaData()

Function: Provides the number, types, and properties of columns in a ResultSet.

Characteristic

Description

Syntax

public ResultSetMetaData getMetaData() throws SQLException

Return

The description of ResultSet object’s columns is returned.

getObject(int columnIndex)

Function: Gets the value of the column designated by columnIndex in the current row of this ResultSet as a Java object.

Characteristic

Description

Syntax

public Object getObject(String columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

A java.lang.Object holding the column value is returned.

Note:  This method returns 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 specification.

You can also use this method to read database-specific abstract data types.

When the 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())

getObject(String columnName)

Function: Gets the value of the column designated by columnName in the current row of this ResultSet as a Java object.

Characteristic

Description

Syntax

public Object getObject(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

A java.lang.Object holding the column value is returned.

Note:  A java.lang.Object holding the column value is returned.

You can also use this method to read database-specific abstract data types.

When the 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())

getRow()

Function: Returns the current row number.

Characteristic

Description

Syntax

public int getRow() throws SQLException

Return

If there is a current row, returns the row number. The first row number is 1.

If there is no current row, returns 0.

Note:  Throws the SQLException if a database access error occurs.

getShort(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row of this ResultSet as a Java short.

Characteristic

Description

Syntax

public short getShort(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is 0.

getShort(String columnName)

Function: Gets the value of a column columnName in the current row of this ResultSet as a Java short.

Characteristic

Description

Syntax

public short getShort(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is 0.

getSQLXML(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row of the ResultSet as a java.sql.SQLXML object.

Characteristic

Description

Syntax

public SQLXML getSQLXML(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second is 2, and so on

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

getSQLXML(String columnName)

Function: Gets the value of a column designated by columnName in the current row of this ResultSet as a java.sql.SQLXML object.

Characteristic

Description

Syntax

public SQLXML getSQLXML(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

getStatement()

Function: Returns the Statement that produced this ResultSet object.

Characteristic

Description

Syntax

public Statement getStatement() throws SQLException

Return

The Statement that produced the ResultSet or null if the ResultSet was produced some other way is returned.

Note:  If the ResultSet was generated some other way, such as by a DatabaseMetaData method, this method returns null.

getString(int columnIndex)

Function: Gets the value of a column designated by columnIndex in the current row of the ResultSet as a Java String.

Characteristic

Description

Syntax

public String getString(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second is 2, and so on

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

getString(String columnName)

Function: Gets the value of a column designated by columnName in the current row of this ResultSet as a Java String.

Characteristic

Description

Syntax

public String getString(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

getTime(int columnIndex)

Function: Gets the value of the column designated by columnIndex in the current row of this ResultSet as a java.sql.Time object.

Characteristic

Description

Syntax

public Time getTime(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

getTime(String columnName)

Function: Gets the value of the column designated by columnName in the current row of this ResultSet as a java.sql.Time object.

Characteristic

Description

Syntax

public Time getTime(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

getTime(int columnIndex, Calendar cal)

Function: Gets the value of the column designated by columnIndex in the current row of this ResultSet as a java.sql.Time object.

Characteristic

Description

Syntax

public Time getTime(int columnIndex, Calendar cal) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so on
  • cal is the calendar to use in constructing the time.

Return

The value of the designated column as a java.sql.Time object is returned.

Note:  If the column value returned is SQL NULL, the result is null.

This method uses the given calendar to construct an appropriate millisecond value for the Time if the underlying database does not store timezone.

When retrieving datatypes with time zone (time and timestamp), the time zone offset is put into calendar time zone offset and can be retrieved using the following command:

cal.getTimeZone().getRawOffset()

This is the milliseconds.

getTime(String columnName, Calendar cal)

Function: Gets the value of the column designated by columnName in the current row of this ResultSet as a jva.sql.Time object.

Characteristic

Description

Syntax

public Time getTime(String columnName, Calendar cal) throws SQLException

where the parameter:

  • columnName is the SQL name of the column
  • cal is the calendar to use in constructing the time.

Return

The value of the designated column as a java.sql.Time object is returned.

Note:  If the column value returned is SQL NULL, the result is null.

This method uses the given calendar to construct an appropriate millisecond value for the Time if the underlying database does not store timezone.

When retrieving datatypes with time zone (time and timestamp), the time zone offset is put into calendar time zone offset and can be retrieved using the following command:

cal.getTimeZone().getRawOffset()

This is the milliseconds.

getTimestamp(int columnIndex)

Function: Gets the value of the column designated by columnIndex in the current row of this ResultSet as a java.sql.Timestamp object.

Characteristic

Description

Syntax

public Timestamp getTimestamp(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

getTimestamp(String columnName)

Function: Gets the value of the column designated by columnName in the current row of this as a java.sql.Timestamp object.

Characteristic

Description

Syntax

public Timestamp getTimestamp(String columnName) throws SQLException

where the columnName parameter is the SQL name of the column

Return

The value of the designated column is returned.

Note:  If the column value returned is SQL NULL, the result is null.

getTimestamp(int columnIndex, Calendar cal)

Function: Gets the value of the column designated by columnIndex in the current row of this ResultSet as a java.sql.Timestamp object.

Characteristic

Description

Syntax

public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so on
  • cal is the calendar to use in constructing the timestamp

Return

The value of the designated column as a java.sql.TimeStamp object is returned.

Note:  If the column value returned is SQL NULL, the result is null.

This method uses the given calendar to construct an appropriate millisecond value for the Timestamp if the underlying database does not store timezone information.

When retrieving datatypes with time zone (time and timestamp), the time zone offset is put into calendar time zone offset and can be retrieved using the following command:

cal.getTimeZone().getRawOffset()

This is the milliseconds.

getTimestamp(String columnName, Calendar cal)

Function: Gets the value of a column in the current row as a java.sql.Timestamp object.

Characteristic

Description

Syntax

public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException

where the parameter:

  • columnName is the SQL name of the column
  • cal is the calendar to use in constructing the timestamp

Return

The value of the designated column as a java.sql.TimeStamp object is returned.

Note:  If the column value returned is SQL NULL, the result is null.

This method uses the given calendar to construct an appropriate millisecond value for the Timestamp if the underlying database does not store timezone information.

When retrieving datatypes with time zone (time and timestamp), the time zone offset is put into calendar time zone offset and can be retrieved using the following command:

cal.getTimeZone().getRawOffset()

This is the milliseconds.

getType()

Function: Returns the ResultSet object type. The Statement object that created the ResultSet determines the ResultSet type.

Characteristic

Description

Syntax

public int getType() throws SQLException

Return

ResultSet.TYPE_FORWARD_ONLY

ResultSet.TYPE_SCROLL_INSENSITIVE, or

ResultSet.TYPE_SCROLL_SENSITIVE

Note:  Throws the SQLException if a database access error occurs.

getUnicodeStream(int columnIndex)

Function: DEPRECATED] Gets the value of the column designated by columnIndex in the current row of this ResultSet as a stream of Unicode characters. The value can then be read in chunks from the stream.

Use getCharacterStream(int columnIndex) in place of getUnicodeStream(int columnIndex).

Characteristic

Description

Syntax

public InputStream getUnicodeStream(int columnIndex) throws SQLException

where the columnIndex parameter is the column specification. The first column is 1, the second column is 2, and so on

Return

A Java input stream that delivers the database column value as a stream of two-byte Unicode characters is returned.

Note:  If the value is SQL NULL, then the result is null.

This method is particularly suitable for retrieving large LONGVARCHAR 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 UTF8, as defined in the Java Virtual Machine Specification.

All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Also, a stream may return 0 when the method available is called, whether there is data available or not.

getUnicodeStream(String columnName)

Function: [DEPRECATED] Gets the value of the column designated by columnName in the current row of this ResultSet as a stream of Unicode characters. The value can then be read in chunks from the stream.

Characteristic

Description

Syntax

public InputStream getUnicodeStream(String columnName) throws SQLException

where columnName is 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 is returned.

Note:  If the value is SQL NULL, then the result is null.

This method is particularly suitable for retrieving large LONGVARCHAR 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 UTF8, as defined in the Java Virtual Machine Specification.

All the data in the returned stream must be read prior to getting the value of any other column. The next call to a get method implicitly closes the stream.

Also, a stream may return 0 when the method available is called, whether there is data available or not.

getWarnings()

Function: The first warning reported by calls on this ResultSet is returned. Subsequent ResultSet warnings will be chained to this SQLWarning.

The warning chain is automatically cleared each time a new row is read.

Characteristic

Description

Syntax

public SQLWarning getWarnings() throws SQLException

Return

The first SQLWarning or null is returned.

Note:  This warning chain only covers warnings caused by ResultSet methods. Any warning caused by statement methods (such as reading OUT parameters) will be chained on the Statement object.

insertRow()

Function: Inserts the contents of the insert row into this ResultSet object and into the database. The cursor must be on the insert row when this method is called.

Characteristic

Description

Syntax

public void insertRow() throws SQLException

 

Note:  Throws the 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

isAfterLast()

Function: Determines whether the cursor in the ResultSet Object is located after the last row and returns the result.

Characteristic

Description

Syntax

public boolean isAfterLast() throws SQLException

Return

True, if the cursor is located after the last row in the ResultSet object

False, if the ResultSet object contains no rows, or if the cursor is not located after the last row

Note:  Throws the SQLException if a database access error occurs.

isBeforeFirst()

Function: Determines whether the cursor in the ResultSet Object is located before the first row and returns the result.

Characteristic

Description

Syntax

public boolean isBeforeFirst() throws SQLException

Return

True, if the cursor is located before the first row in the ResultSet object

False, if the ResultSet object contains no rows, or if the cursor is not located before the first row

Note:  Throws the SQLException if a database access error occurs.

isFirst()

Function: Determines whether the cursor in the ResultSet Object is located on the first row and returns the result.

Characteristic

Description

Syntax

public boolean isFirst() throws SQLException

Return

True, if the cursor is located on the first row in the ResultSet object

False, if the cursor is not located on the first row

Note:  Throws the SQLException if a database access error occurs.

isLast()

Function: Determines whether the cursor in the ResultSet Object is located on the last row and returns the result.

Characteristic

Description

Syntax

public boolean isLast() throws SQLException

Return

True, if the cursor is located on the last row in the ResultSet object

False, if the cursor is not located on the last row

Note:  Throws the SQLException if a database access error occurs.

Calling isLast() may require the driver to fetch ahead one row to determine if the current row of the ResultSet object is the last row.

last()

Function: Repositions the cursor to the last row.

Characteristic

Description

Syntax

public boolean last() throws SQLException

Return

True, if the cursor is repositioned to a valid row in the ResultSet object

False, if the cursor is not repositioned to a valid row in the ResultSet object

Note:  Throws the SQLException if a database access error occurs, or if the ResultSet type is TYPE_FORWARD_ONLY.

moveToCurrentRow()

Function: Moves 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.

Characteristic

Description

Syntax

public void moveToCurrentRow() throws SQLException

Note:  Throws the SQLException if a database access error occurs or the result set is not updatable.

moveToInsertRow()

Function: Moves 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 the updater methods prior to inserting the row into the result set. Only the updater, getter, and insertRow methods may be called when the cursor is on the insert row. All of the non-nullable columns in a result set must be given a value each time this method is called before calling insertRow. An updater method must be called before a getter method can be called on a column value.

Characteristic

Description

Syntax

public void moveToInsertRow() throws SQLException

Note:  Throws the SQLException if a database access error occurs or the result set is not updatable.

next()

Function: Repositions the cursor down one row from its current position.

Characteristic

Description

Syntax

public boolean next() throws SQLException

Result

True, if the row where the cursor is repositioned is valid

False, if there are no more rows

Note:  A ResultSet cursor is initially positioned before its first row. The first call to next makes the first row the current row. The second call makes the second row the current row, and so forth.

If an input stream from the previous row is open, it is implicitly closed. The ResultSet’s warning chain is cleared when a new row is read.

previous()

Function: Repositions the cursor to the previous row in the ResultSet object.

Characteristic

Description

Syntax

public boolean previous() throws SQLException

Return

True, if the row where the cursor is repositioned is valid

False, if the cursor is repositioned off the ResultSet

Note:  Throws the SQLException if a database access error occurs, or if the ResultSet type is TYPE_FORWARD_ONLY.

refreshRow()

Function: An application is not supposed to call the refreshRow() method when the cursor is on the insert row. The refreshRow() method throws an SQLException if the cursor is on the insert row. This method clears up the column values updated by a set of updater methods for the current row in the result set. If refreshRow is called after calling an updater method, but before calling the updateRow method, then the updates made to the row are lost.

The refreshRow() method does not read the row from data source again to refresh the current row.

Characteristic

Description

Syntax

public void refreshRow() throws SQLException

Note:  Throws the SQLException if a database access error occurs or if this method is called when the cursor is on the insert row.

relative(int rows)

Function: Repositions the cursor within the ResultSet a relative number of rows forward or backward from the current position.

Characteristic

Description

Syntax

public boolean relative(int rows) throws SQLException

where the rows parameter is an integer that specifies the number of rows to move from the current position. To move forward, specify a positive number. Although 0 is valid, the cursor position will not change.

Return

True, if the row where the cursor is repositioned is valid

False, if otherwise

Note:  Throws the SQLException if a database access error occurs, if there is no current row, or if the ResultSet type is TYPE_FORWARD_ONLY.

rowDeleted()

Function: Detects and indicates if a row was deleted.

Characteristic

Description

Syntax

public boolean rowDeleted() throws SQLException

Return

True, if a row was deleted and the deletion was detected

False, if otherwise

Note:  The value returned is dependent on whether the ResultSet object is capable of detecting deletions.

rowInserted()

Function: Detects and indicates if insertions were made into the current row.

Characteristic

Description

Syntax

public boolean rowInserted() throws SQLException

Return

True, if insertions were made into the current row and the insertion was detected

False, if insertions were not made into the current row or the insertion was not detected

Note:  The value returned is dependent on whether the ResultSet object is capable of detecting visible inserts.

rowUpdated()

Function: Detects and indicates if updates were made to the current row.

Characteristic

Description

Syntax

public boolean rowUpdated() throws SQLException

Return

True, if updates were made into the current row and the updates were detected

False, if updates were not made into the current row or the updates were not detected

Note:  The value returned is dependent on whether the ResultSet object is capable of detecting visible updates.

setFetchDirection(int direction)

Function: Sets the fetch direction of this ResultSet. Permits the application to indicate to the Teradata JDBC Driver the direction in which rows will be fetched. Possible values are ResultSet.FETCH_FORWARD or ResultSet.FETCH_REVERSE. The default is ResultSet.FETCH_FORWARD. Please note that this method is supported, but has no effect.

Characteristic

Description

Syntax

public void setFetchDirection(int direction) throws SQLException

where the direction parameter is the new fetch direction.

setFetchSize(int rows)

Function: Sets the fetch size of this ResultSet. Beginning with Teradata JDBC Driver 13.10.00.25 and Teradata Database 13.10, this method enables the application to specify how many rows should be fetched at a time from the database. The default is zero. If the value is zero, then the database decides how many rows to return at a time.

Characteristic

Description

Syntax

public void setFetchSize(int rows) throws SQLException

where the rows parameter is the new fetch size.

updateAsciiStream(int columnIndex, InputStream x, int length)

Function: Updates the designated column with an ascii stream value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead, the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value
  • length is the length of the stream

Note:  Throws the SQLException if a database access error occurs.

updateAsciiStream(String columnName, InputStream x, int length)

Function: Updates the designated column with an ascii stream value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value
  • length is the length of the stream

Note:  Throws the SQLException if a database access error occurs.

updateBigDecimal(int columnIndex, BigDecimal x)

Function: Updates the designated column with a java.math.BigDecimal value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateBigDecimal(String columnName, BigDecimal x)

Function: Updates the designated column with a java.math.BigDecimal value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateBinaryStream(int columnIndex, InputStream x, int length)

Function: Updates the designated column with a binary stream value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value
  • length is the length of the stream

Note:  Throws the SQLException if a database access error occurs.

updateBinaryStream(String columnName, InputStream x, int length)

Function: Updates the designated column with a binary stream value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value
  • length is the length of the stream

Note:  Throws the SQLException if a database access error occurs.

updateBlob(int columnIndex, Blob x)

Function: Updates the designated column with a java.sql.Blob value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateBlob(int columnIndex, Blob x) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateBlob(String columnName, Blob x)

Function: Updates the designated column with a java.sql.Blob value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateBlob(String columnName, Blob x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateByte(int columnIndex, byte x)

Function: Updates the designated column with a byte value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateByte(int columnIndex, byte x) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateByte(String columnName, byte x)

Function: Updates the designated column with a byte value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateByte(String columnName, byte x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateBytes(int columnIndex, byte[ ] x)

Function: Updates the designated column with a byte array value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateBytes(int columnIndex, byte[] x) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateBytes(String columnName, byte[ ] x)

Function: Updates the designated column with a byte array value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateBytes(String columnName, byte[] x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateCharacterStream(int columnIndex, Reader x, int length)

Function: Updates the designated column with a character stream value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value
  • length is the length of the stream

Note:  Throws the SQLException if a database access error occurs.

updateCharacterStream(String columnName, Reader x, int length)

Function: Updates the designated column with a character stream value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateCharacterStream(String columnName, Reader x, int length) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value
  • length is the length of the stream

Note:  Throws the SQLException if a database access error occurs.

updateClob(int columnIndex, Clob x)

Function: Updates the designated column with a java.sql.Clob value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateClob(int columnIndex, Clob x) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateClob(String columnName, Clob x)

Function: Updates the designated column with a java.sql.Clob value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateClob(String columnName, Clob x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateDate(int columnIndex, Date x)

Function: Updates the designated column with a java.sql.Date value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateDate(int columnIndex, Date x) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateDate(String columnName, Date x)

Function: Updates the designated column with a java.sql.Date value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateDate(String columnName, Date x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateDouble(int columnIndex, double x)

Function: Updates the designated column with a double value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateDouble(int columnIndex, double x) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateDouble(String columnName, double x)

Function: Updates the designated column with a double value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateDouble(String columnName, double x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateFloat(int columnIndex, float x)

Function: Updates the designated column with a float value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateFloat(int columnIndex, float x) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateFloat(String columnName, float x)

Function: Updates the designated column with a float value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateFloat(String columnName, float x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateInt(int columnIndex, int x)

Function: Updates the designated column with an int value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateInt(int columnIndex, int x)throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateInt(String columnName, int x)

Function: Updates the designated column with an int value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateInt(String columnName, int x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateLong(int columnIndex, long x)

Function: Updates the designated column with a long value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateLong(int columnIndex, long x) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateLong(String columnName, long x)

Function: Updates the designated column with a long value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateLong(String columnName, long x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateNull(int columnIndex)

Function: Gives a nullable column a null value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateNull(int columnIndex) throws SQLException

where the parameter columnIndex is the column specification. The first column is 1, the second column is 2, and so forth

Note:  Throws the SQLException if a database access error occurs.

updateNull(String columnName)

Function: Gives a nullable column a null value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateNull(String columnName)throws SQLException

where the parameter columnName is the name of the column

Note:  Throws the SQLException if a database access error occurs.

updateObject(int columnIndex, Object x)

Function: Updates the designated column with an Object value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateObject(int columnIndex, Object x)throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateObject(int columnIndex, Object x, int scale)

Function: Updates the designated column with an Object value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateObject(int columnIndex, Object x, int scale)throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value
  • scale is the number of digits after the decimal point (for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC). For all other types, this value is ignored.

Note:  Throws the SQLException if a database access error occurs.

updateObject(String columnName, Object x)

Function: Updates the designated column with an Object value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateObject(String columnName, Object x)throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateObject(String columnName, Object x, int scale)

Function: Updates the designated column with an Object value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateObject(String columnName, Object x, int scale) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value
  • scale is the number of digits after the decimal point (for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types). For all other types, this value is ignored.

Note:  Throws the SQLException if a database access error occurs.

updateRow()

Function: Updates the underlying database with the new contents of the current row of this ResultSet object. This method cannot be called when the cursor is on the insert row.

Characteristic

Description

Syntax

public void updateRow()throws SQLException

Note:  Throws the SQLException if a database access error occurs or if this method is called when the cursor is on the insert row.

updateShort(int columnIndex, short x)

Function: Updates the designated column with a short value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateShort(int columnIndex, short x)throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateShort(String columnName, short x)

Function: Updates the designated column with a short value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateShort(String columnName, short x)throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateSQLXML(int columnIndex, SQLXML x)

Function: Updates the designated column with a java.sql.SQLXML value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws SQLException if a database access error occurs.

This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

updateSQLXML(String columnName, SQLXML x)

Function: Updates the designated column with a java.sql.SQLXML value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateShort(String columnName, short x) throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws SQLException if a database access error occurs.

This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

updateString(int columnIndex, String x)

Function: Updates the designated column with a String value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateString(int columnIndex, String x)throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateString(String columnName, String x)

Function: Updates the designated column with a String value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateString(String columnName, String x)throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateTime(int columnIndex, Time x)

Function: Updates the designated column with a java.sql.Time value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateTime(int columnIndex, Time x)throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateTime(String columnName, Time x)

Function: Updates the designated column with a java.sql.Time value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateTime(String columnName, Time x)throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateTimestamp(int columnIndex, Timestamp x)

Function: Updates the designated column with a java.sql.Timestamp value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateTimestamp(int columnIndex, Timestamp x)throws SQLException

where the parameter:

  • columnIndex is the column specification. The first column is 1, the second column is 2, and so forth
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

updateTimestamp(String columnName, Timestamp x)

Function: Updates the designated column with a java.sql.Timestamp value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database.

Characteristic

Description

Syntax

public void updateTimestamp(String columnName, Timestamp x)throws SQLException

where the parameter:

  • columnName is the name of the column
  • x is the new column value

Note:  Throws the SQLException if a database access error occurs.

wasNull()

Function: A column may have the value of SQL NULL. The wasNull method reports whether the last column read had this special value.

Characteristic

Description

Syntax

public boolean wasNull() throws SQLException

Return

True, if the last column read was SQL NULL

False, if otherwise

Note:  You must first call getXXX on a column to try to read its value and then call wasNull() to find if the value was the SQL NULL.

ResultSetMetaData Interface

Description

The ResultSetMetaData object returned by the ResultSet getMetaData method provides the number, types, and properties of a ResultSet’s columns.

Methods

Supported

getCatalogName(int column)

Yes

getColumnClassName(int column)

Yes

getColumnCount()

Yes

getColumnDisplaySize(int column)

Yes

getColumnLabel(int column)

Yes

getColumnName(int column)

Yes

getColumnType(int column)

Yes

getColumnTypeName(int column)

Yes

getPrecision(int column)

Yes

getScale(int column)

Yes

getSchemaName(int column)

Yes

getTableName(int column)

Yes

isAutoIncrement(int column)

Yes

isCaseSensitive(int column)

Yes

isCurrency(int column)

Yes*

isDefinitelyWritable(int column)

Yes

isNullable(int column)

Yes

isReadOnly(int column)

Yes

isSearchable(int column)

Yes

isSigned(int column)

Yes

isWritable(int column)

Yes

Methods

The following subsections provide a brief description of each supported ResultSetMetaData method.

getCatalogName(int column)

Function: Retrieves the name of the catalog that contains the schema that contains the designated column's table.

Characteristic

Description

Syntax

public String getCatalogName(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

A zero-length string "" by default, to indicate that the database does not support catalogs.

Or a JSON string containing all the result set column metadata received from the database, when the escape function {fn teradata_provide(request_scope_catalog_json)} is specified in the SQL request, beginning with Teradata JDBC Driver 20.00.00.06.

getColumnClassName(int column)

Function: Retrieves the fully qualified name of the Java class whose instances would be returned by the method ResultSet.getObject.

Characteristic

Description

Syntax

public String getColumnClassName(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second is 2, and so on.

Return

The fully qualified name of the class in the Java programming language whose instances would be returned by the method PreparedStatementResultSet.getObject. If there is an entry in the connection's type map for the object, the Java class name mapped to the UDT is returned.

null is returned if the Class name cannot be determined.

getColumnCount()

Function: Retrieves the number of columns in the ResultSet object for which this ResultSetMetaData object contains information.

Characteristic

Description

Syntax

public int getColumnCount() throws SQLException

Return

The number of columns is returned.

getColumnDisplaySize(int column)

Function: Retrieves the designated column's normal maximum width in characters.

Characteristic

Description

Syntax

public int getColumnDisplaySize(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

column width in characters; zero if not applicable.

With Teradata Database V2R6.1 and earlier, the display size for any character data type is calculated with respect to the Teradata session character set, and assumes that the DBSControl Export Width Table ID is set to zero. The display size may not be accurate for character data types if the CLIENT_CHARSET connection parameter is specified, or if the DBSControl Export Width Table ID is set to something other than zero.

getColumnLabel(int column)

Function: Retrieves the title or description of the designated column.

Characteristic

Description

Syntax

public String getColumnLabel(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

column title if connection parameter COLUMN_NAME=OFF is specified, or COLUMN_NAME is omitted, or JDBC Escape function {fn teradata_provide(request_scope_column_name_off)} is specified in the SQL request.

 

Beginning with Teradata JDBC Driver 16.00.00.28, returns AS-clause name if available, or the column name if available, or the column title, if connection parameter COLUMN_NAME=ON is specified, or JDBC Escape function {fn teradata_provide(request_scope_column_name_on)} is specified in the SQL request.

getColumnName(int column)

Function: Retrieves the name of the designated column.

Characteristic

Description

Syntax

public String getColumnName(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

AS-clause name if available, or the column name if available, or the column title, if connection parameter COLUMN_NAME=OFF is specified, or COLUMN_NAME is omitted, or JDBC Escape function {fn teradata_provide(request_scope_column_name_off)} is specified in the SQL request.

 

Beginning with Teradata JDBC Driver 16.00.00.28, returns column name if available, if connection parameter COLUMN_NAME=ON is specified, or JDBC Escape function {fn teradata_provide(request_scope_column_name_on)} is specified in the SQL request.

getColumnType(int column)

Function: Retrieves the designated column’s SQL type.

Characteristic

Description

Syntax

public int getColumnType(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on

Return

SQL type from java.sql.Types.

java.sql.Types.NULL will be returned if the column type cannot be determined.

getColumnTypeName(int column)

Function: Retrieves the designated column’s database-specific type name.

Characteristic

Description

Syntax

public String getColumnTypeName(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

the name of the column's data type, as used by the database. If the column type is a user-defined type, then a fully qualified type name is returned.

null is returned if the column typeName cannot be determined.

getPrecision(int column)

Function: Retrieves the designated column’s number of decimal digits.

Characteristic

Description

Syntax

public int getPrecision(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

precision. Zero is returned if precision is not applicable to the column.

getScale(int column)

Function: Retrieves the designated column’s number of digits to the right of the decimal point.

Characteristic

Description

Syntax

public int getScale(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

scale. Zero is returned if scale is not applicable to the column.

getSchemaName(int column)

Function: Retrieves the name of the schema that contains the designated column's table. Supported with the combination of Teradata Database V2R6.2 or later, and Teradata JDBC Driver 03.04.00.00 or later.

Characteristic

Description

Syntax

public String getSchemaName(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

schema name, or "" (zero-length string) if not applicable.

getTableName(int column)

Function: Retrieves the name of the table that contains the designated column. Supported with the combination of Teradata Database V2R6.2 or later, and Teradata JDBC Driver 03.04.00.00 or later.

Characteristic

Description

Syntax

public String getTableName(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

table name, or "" (zero-length string) if not applicable.

isAutoIncrement(int column)

Function: Indicates whether the designated column's data values are automatically generated by the database. Supported with the combination of Teradata Database V2R6.2 or later, and Teradata JDBC Driver 03.04.00.00 or later.

Characteristic

Description

Syntax

public boolean isAutoIncrement(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

True, if so; False, otherwise

isCaseSensitive(int column)

Function: Indicates whether the designated column's data values are case-sensitive.

Characteristic

Description

Syntax

public boolean isCaseSensitive(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

True, if so; False, otherwise

isCurrency(int column)

Function: Indicates whether the designated column's data type represents currency values.

Characteristic

Description

Syntax

public boolean isCurrency(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

True, if so; False, otherwise

isDefinitelyWritable(int column)

Function: Indicates whether a write on the designated column will definitely succeed. Supported with the combination of Teradata Database V2R6.2 or later, and Teradata JDBC Driver 03.04.00.00 or later.

Characteristic

Description

Syntax

public boolean isDefinitelyWritable(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

True, if so; False, otherwise

isNullable(int column)

Function: Indicates whether null values are allowed in the designated column.

Characteristic

Description

Syntax

public int isNullable(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

the column's nullability status; one of the values:

ResultSetMetaData.columnNoNulls, ResultSetMetaData.columnNullable, or ResultSetMetaData.columnNullableUnknown.

 

Beginning with Teradata JDBC Driver 16.00.00.28, when connection parameter MAYBENULL=ON is specified, and/or JDBC escape function {fn teradata_provide(request_scope_maybenull_on)} is specified in the SQL request, and StatementInfo parcel support is available, the return value is determined from the StatementInfo parcel MayBeNull field, rather than the IsNullable field.

isReadOnly(int column)

Function: Indicates whether the designated column is definitely not writable. Supported with the combination of Teradata Database V2R6.2 or later, and Teradata JDBC Driver 03.04.00.00 or later.

Characteristic

Description

Syntax

public boolean isReadOnly(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

True, if so; False, otherwise

isSearchable(int column)

Function: Indicates whether the designated column can be specified in a WHERE clause. Supported with the combination of Teradata Database V2R6.2 or later, and Teradata JDBC Driver 03.04.00.00 or later.

Characteristic

Description

Syntax

public boolean isSearchable(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

True, if so; False, otherwise

isSigned(int column)

Function: Indicates whether values for the designated column can be signed numbers. Supported with the combination of Teradata Database V2R6.2 or later, and Teradata JDBC Driver 03.04.00.00 or later.

Characteristic

Description

Syntax

public boolean isSigned(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

True, if so; False, otherwise

isWritable(int column)

Function: Indicates whether it is possible for a write on the designated column to succeed. Supported with the combination of Teradata Database V2R6.2 or later, and Teradata JDBC Driver 03.04.00.00 or later.

Characteristic

Description

Syntax

public boolean isWritable(int column) throws SQLException

where the column parameter specifies the column - the first column is 1, the second column is 2, and so on.

Return

True, if so; False, otherwise

SQLXML Interface

Description

This section describes the SQLXML interface. Teradata Database 14.10 and later provide a built-in XML data type that stores an XML value as a column value in a row of a database table. The java.sql.SQLXML interface and the SQL XML data type are supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19. JDK 6.0 or later is required to use SQLXML functionality. The SQLXML interface provides methods for accessing an XML value as a String, a Reader or Writer, or as a Stream. An XML value may also be accessed through a Source or set as a Result.

Methods

Supported

free()

Yes

getBinaryStream()

Yes

getCharacterStream()

Yes

getSource(Class<T> sourceClass)

Yes

getString()

Yes

setBinaryStream()

Yes

setCharacterStream()

Yes

setResult(Class<T> resultClass)

Yes

setString()

Yes

Methods

free()

Function: Closes this object and releases the resources that it held. The SQLXML object becomes invalid.

Characteristic

Description

Syntax

public void free() throws SQLException

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

The SQLXML Object becomes not readable and not writable after this method is called.

getBinaryStream()

Function: Retrieves the XML value designated by this SQLXML instance as a stream.

Characteristic

Description

Syntax

public InputStream getBinaryStream() throws SQLException

Return

A Stream containing the XML data.

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

The SQLXML Object becomes not readable and not writable after this method is called.

getCharacterStream()

Function: Retrieves the XML value designated by this SQLXML instance as a java.io.Reader object.

Characteristic

Description

Syntax

public Reader getCharacterStream() throws SQLException

Return

A stream containing the XML data.

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

The SQLXML Object becomes not readable and not writable after this method is called.

getSource(Class<T> sourceClass)

Function: Returns a Source for reading the XML value designated by this SQLXML instance.

Characteristic

Description

Syntax

public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException

where sourceClass is the class of the source. The following classes are supported:

  • javax.xml.transform.dom.DOMSource - returns a DOMSource
  • javax.xml.transform.sax.SAXSource - returns a SAXSource
  • javax.xml.transform.stax.StAXSource - returns a StAXSource
  • javax.xml.transform.stream.StreamSource - returns a StreamSource

Return

A Source for reading the XML value.

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

The SQLXML Object becomes not readable and not writable after this method is called.

If the parameter sourceClass is null, the Teradata JDBC Driver throws an SQLException.

getString()

Function: Returns a string representation of the XML value designated by this SQLXML instance.

Characteristic

Description

Syntax

public String getString() throws SQLException

Return

A string representation of the XML value designated by this SQLXML instance.

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

The SQLXML Object becomes not readable and not writable after this method is called.

setBinaryStream()

Function: Retrieves a stream that can be used to write the XML value that this SQLXML instance represents.

Characteristic

Description

Syntax

public OutputStream setBinaryStream() throws SQLException

Return

A stream to which data can be written.

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

The SQLXML Object becomes not readable and not writable after this method is called.

This method only supports the OutputStream containing UTF8-encoded characters.

setCharacterStream()

Function: Retrieves a stream to be used to write the XML value that this SQLXML instance represents.

Characteristic

Description

Syntax

public Writer setCharacterStream() throws SQLException

Return

A stream to which data can be written.

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

The SQLXML Object becomes not readable and not writable after this method is called.

setResult(Class<T> resultClass)

Function: Returns a Result for setting the XML value designated by this SQLXML instance.

Characteristic

Description

Syntax

public <T extends Result> T setResult(Class<T> resultClass) throws SQLException

where resultClass is the class of the result. The following classes are supported:

  • javax.xml.transform.dom.DOMResult - returns a DOMResult
  • javax.xml.transform.sax.SAXResult - returns a SAXResult
  • javax.xml.transform.stax.StAXResult - returns a StAXResult
  • javax.xml.transform.stream.StreamResult - returns a StreamResult

Return

A Result for setting the XML value.

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

The SQLXML Object becomes not readable and not writable after this method is called.

If the parameter resultClass is null, the Teradata JDBC Driver throws an SQLException.

setString(String value)

Function: Sets the XML value designated by this SQLXML instance to the given String representation.

Characteristic

Description

Syntax

public void setString(String value) throws SQLException

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

The SQLXML Object becomes not readable and not writable after this method is called.

Statement Interface

Description

A Statement object is used for:

Only one ResultSet per Statement can be open at any point in time. Therefore, if the reading of one ResultSet is interleaved with the reading of another, each must have been generated by different Statements. All Statement execute methods implicitly close a Statement's current ResultSet if an open one exists.

Methods

Supported

addBatch(String sql)

Yes

cancel()

Yes

clearBatch()

Yes

clearWarnings()

Yes

close()

Yes

execute(String sql)

Yes

execute(String sql, int autoGeneratedKeys)

Yes

execute(String sql, int[] columnIndexes)

Yes

execute(String sql, String[] columnNames)

Yes

executeBatch()

Yes

executeQuery(String sql)

Yes

executeUpdate(String sql)

Yes

executeUpdate(String sql, int autoGeneratedKeys)

Yes

executeUpdate(String sql, int[] columnIndexes)

Yes

executeUpdate(String sql, String[] columnNames)

Yes

getConnection()

Yes

getFetchDirection()

Yes

getFetchSize()

Yes

getGeneratedKeys()

Yes

getMaxFieldSize()

Yes

getMaxRows()

Yes

getMoreResults()

Yes

getMoreResults(int current)

Yes

getQueryTimeout()

Yes

getResultSet()

Yes

getResultSetConcurrency()

Yes

getResultSetHoldability()

Yes

getResultSetType()

Yes

getUpdateCount()

Yes

getWarnings()

Yes

setCursorName(String name)

No

setEscapeProcessing(boolean enable)

Yes

setFetchDirection(int direction)

Yes*

setFetchSize(int rows)

Yes

setMaxFieldSize(int max)

Yes

setMaxRows(int max)

Yes

setQueryTimeout(int seconds)

Yes

Methods

The following subsections provide a brief description of each supported Statement method.

addBatch(String sql)

Function: Adds an SQL command to the current batch of commands for this Statement object.

Characteristic

Description

Syntax

public void addBatch(String sql) throws SQLException

where the sql parameter is any SQL statement

cancel()

Function: Cancel can be used by one thread to cancel a statement that is being executed by another thread.

If the database is still processing the statement when the cancel method is called, then the statement will be cancelled. If the statement had been completed upon receipt of the cancel request, the statement will not be cancelled.

In Teradata transaction mode, cancelling a statement rolls back the transaction enclosing the statement. This is the correct and expected behavior for Teradata transaction mode.

Warning:  

In ANSI transaction mode, with auto-commit turned off, cancelling a statement may sometimes roll back the transaction enclosing the statement. This is incorrect behavior for ANSI transaction mode. The intent is to correct this behavior in a future release. Until this behavior is corrected, users are urged to avoid using the cancel method in the problematic situations.

Warning:  

In ANSI transaction mode, using prepared statement batch updates, cancelling the prepared statement may sometimes roll back the transaction enclosing the prepared statement, and may return erroneous update counts for some of the updates in the batch. This is incorrect behavior for ANSI transaction mode. The intent is to correct this behavior in a future release. Until this behavior is corrected, users are urged to avoid using the cancel method in the problematic situations.

Characteristic

Description

Syntax

public void cancel() throws SQLException

clearBatch()

Function: Makes the set of commands in the current batch empty.

Characteristic

Description

Syntax

public void clearBatch() throws SQLException

clearWarnings()

Function: Clears all the warnings reported on this statement. After this call, getWarnings returns null until a new warning is reported for this Statement.

Characteristic

Description

Syntax

public void clearWarnings() throws SQLException

close()

Function: In many cases, it is desirable to immediately release a Statement’s database and JDBC resources instead of waiting for this to happen when it is automatically closed. The close method provides this immediate release.

Characteristic

Description

Syntax

public void close() throws SQLException

Return

A Statement is automatically closed when it is garbage collected. When a Statement is closed, its current ResultSet, if one exists, is also closed.

execute(String sql)

Function: Executes an SQL statement that may return multiple results.

Characteristic

Description

Syntax

public boolean execute(String sql) throws SQLException

where the sql parameter is any SQL statement

Return

True, if the next result is a ResultSet

False, if it is an update count or if there are no more results

Note:  Under some uncommon situations, a single SQL statement may return multiple ResultSets and/or update counts. Normally, this can be ignored, unless a stored procedure that is known to return multiple results is executing, or an unknown SQL string is dynamically executing.

The execute, getMoreResults, getResultSet, and getUpdateCount methods allow navigation through multiple results. The execute method executes an SQL statement and indicates the form of the first result. Then, to retrieve the result, use getResultSet or getUpdateCount; to move to any subsequent results, use getMoreResults.

See also getResultSet(), getUpdateCount(), and getMoreResults().

executeBatch()

Function: Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.

The int 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 are added to the batch. The elements in the array returned by the method executeBatch may be one of the following:

Characteristic

Description

Syntax

public int[] executeBatch() throws SQLException

Return

an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which commands were added to the batch.

Note:  Throws BatchUpdateException (a subclass of SQLException) if one of the commands sent to the database fails to execute properly or attempts to return a result set.

An exception is returned if used to execute a statement that returns result sets.

The error is 1080: executeBatch() cannot be used when a result set is expected; use execute().

Beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.25, for row count values received from the database that are too large to fit into a signed 32-bit integer, the Teradata JDBC Driver will return an update count of Integer.MAX_VALUE to the application, and will provide a SQLWarning with error code 1474 that lists the actual row count in the message text.

execute(String sql, int autoGeneratedKeys)

Function: Executes the given SQL statement, which may return multiple results, and signals the driver to make any auto-generated keys available for retrieval. The driver ignores this signal if the SQL statement is not an INSERT statement.

In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally, you can ignore this unless you are:

The execute method executes an SQL statement and indicates the form of the first result. Then, to retrieve the result, use getResultSet or getUpdateCount; to move to any subsequent results, use getMoreResults.

Characteristic

Description

Syntax

public boolean execute(String sql, int autogeneratedKeys) throws SQLException

where the parameter:

  • sql is any SQL statement
  • autoGeneratedKeys is a constant indicating whether auto-generated keys should be made available for retrieval using the method getGeneratedKeys; one of the following constants: Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS

Return

True, if the first result is a ResultSet object

False, if it is an update count or there are no results

Note:  Throws an SQLException if a database access error occurs or the second parameter supplied to this method is not Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS.

execute(String sql, int[ ] columnIndexes)

Function: Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver ignores the array if the given SQL statement is not an INSERT statement.

In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally, you can ignore this unless you are:

The execute method executes an SQL statement and indicates the form of the first result. Then, to retrieve the result, use getResultSet or getUpdateCount; to move to any subsequent results, use getMoreResults.

Characteristic

Description

Syntax

public boolean execute(String sql, int[] columnIndexes) throws SQLException

where the parameter:

  • sql is any SQL statement
  • columnIndexes is an array of the indexes of the columns in the inserted row that should be made available for retrieval by a call to the method getGeneratedKeys

Return

True, if the first result is a ResultSet object

False, if it is an update count or there are no results

Note:  Throws an SQLException if a database access error occurs or the elements in the int array passed to this method are not valid column indexes.

execute(String sql, String[ ] columnNames)

Function: Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver ignores the array if the given SQL statement is not an INSERT statement.

In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally, you can ignore this unless you are:

The execute method executes an SQL statement and indicates the form of the first result. Then, to retrieve the result, use getResultSet or getUpdateCount; to move to any subsequent results, use getMoreResults.

Characteristic

Description

Syntax

public boolean execute(String sql, String[] columnNames) throws SQLException

where the parameter:

  • sql is any SQL statement
  • columnNames is an array of the names of the columns in the inserted row that should be made available for retrieval by a call to the method getGeneratedKeys

Return

True, if the next result is a ResultSet object

False, if it is an update count or there are no more results

Note:  Throws an SQLException if a database access error occurs or the elements in the String array passed to this method are not valid column names.

executeQuery(String sql)

Function: Executes an SQL statement that returns a single ResultSet.

Characteristic

Description

Syntax

public ResultSet executeQuery(String sql) throws SQLException

where the sql parameter is, typically, a static SQL SELECT statement

Return

A ResultSet that contains the data produced by the query–never null–is returned.

executeUpdate(String sql)

Function: Executes an SQL INSERT, UPDATE, or DELETE statement. In addition, SQL statements that return nothing, such as DDL statements, can be executed.

Characteristic

Description

Syntax

public int executeUpdate(String sql) throws SQLException

where the sql parameter is any SQL INSERT, UPDATE, or DELETE statement, or an SQL statement that returns nothing

Return

Either the row count for INSERT, UPDATE, or DELETE is returned; or 0 for SQL statements that return nothing is returned.

Note:  Beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.25, for row count values received from the database that are too large to fit into a signed 32-bit integer, the Teradata JDBC Driver will return an update count of Integer.MAX_VALUE to the application, and will provide a SQLWarning with error code 1474 that lists the actual row count in the message text.

executeUpdate(String sql, int autoGeneratedKeys)

Function: Executes an SQL INSERT, UPDATE, or DELETE statement. In addition, SQL statements that return nothing, such as DDL statements, can be executed.

Characteristic

Description

Syntax

public int executeUpdate(String sql, int autogeneratedKeys) throws SQLException

where the parameter:

  • sql is any SQL INSERT, UPDATE, or DELETE statement, or an SQL statement that returns nothing
  • autoGeneratedKeys is a flag indicating whether auto-generated keys should be made available for retrieval; one of the following constants: Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS

Return

Either the row count for INSERT, UPDATE, or DELETE is returned; or 0 for SQL statements that return nothing is returned.

Note:  Throws an SQLException if a database access error occurs, the given SQL statement returns a ResultSet object, or the given constant is not one of those allowed.

Beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.25, for row count values received from the database that are too large to fit into a signed 32-bit integer, the Teradata JDBC Driver will return an update count of Integer.MAX_VALUE to the application, and will provide a SQLWarning with error code 1474 that lists the actual row count in the message text.

executeUpdate(String sql, int[ ] columnIndexes)

Function: Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver ignores the array if the SQL statement is not an INSERT statement.

Characteristic

Description

Syntax

public int executeUpdate(String sql, int[] columnIndexes) throws SQLException

where the parameter:

  • sql is an SQL INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement
  • columnIndexes is an array of column indexes indicating the columns that should be returned from the inserted row

Return

Either the row count for INSERT, UPDATE, or DELETE is returned; or 0 for SQL statements that return nothing is returned.

Note:  Throws an SQLException if a database access error occurs, the given SQL statement returns a ResultSet object, or the second argument supplied to this method is not an int array whose elements are valid column indexes.

Beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.25, for row count values received from the database that are too large to fit into a signed 32-bit integer, the Teradata JDBC Driver will return an update count of Integer.MAX_VALUE to the application, and will provide a SQLWarning with error code 1474 that lists the actual row count in the message text.

executeUpdate(String sql, String[ ] columnNames)

Function: Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver ignores the array if the SQL statement is not an INSERT statement.

Characteristic

Description

Syntax

public int executeUpdate(String sql, String[] columnNames) throws SQLException

where the parameter:

  • sql is an SQL INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing
  • columnNames is an array of names of the columns that should be returned from the inserted row

Return

Either the row count for INSERT, UPDATE, or DELETE is returned; or 0 for SQL statements that return nothing is returned.

Note:  Throws an SQLException if a database access error occurs, the given SQL statement returns a ResultSet object, or the second argument supplied to this method is not a String array whose elements are valid column names.

Beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.25, for row count values received from the database that are too large to fit into a signed 32-bit integer, the Teradata JDBC Driver will return an update count of Integer.MAX_VALUE to the application, and will provide a SQLWarning with error code 1474 that lists the actual row count in the message text.

getConnection()

Function: Gets the connection object that produced statement.

Characteristic

Description

Syntax

public Connection getConnection() throws SQLException

Return

Gets the connection object that produced this statement object.

getFetchDirection()

Function: Gets the fetch direction of the Statement.

Characteristic

Description

Syntax

public float getFetchDirection() throws SQLException

Return

The current fetch direction for the Statement is returned.

getFetchSize()

Function: Gets the fetch size of the Statement.

Characteristic

Description

Syntax

public int getFetchSize() throws SQLException

Return

The current fetch size for the Statement is returned.

getGeneratedKeys()

Function: Retrieves any auto-generated keys created as a result of executing this Statement object. If this Statement object did not generate any keys, an empty ResultSet object is returned.

Characteristic

Description

Syntax

ResultSet getGeneratedKeys() throws SQLException

Return

A ResultSet object containing the auto-generated key(s) generated by the execution of this Statement object is returned.

getMaxFieldSize()

Function: Returns the maxFieldSize limit in bytes.

Characteristic

Description

Syntax

public int getMaxFieldSize() throws SQLException

Return

The current maximum column size limit is returned. Zero means unlimited.

Note:  If the limit is exceeded, the excess data is discarded.

The maxFieldSize is the maximum amount of data returned for any column value. It only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns.

getMaxRows()

Function: Returns the maxRows limit.

Characteristic

Description

Syntax

public int getMaxRows() throws SQLException

Return

The current maximum row limit is returned. Zero means unlimited.

Note:  The maxRows limit is the maximum number of rows that a ResultSet can contain. If the limit is exceeded, the excess rows are dropped.

getMoreResults()

Function: Moves to a Statement’s next result. It returns true if this result is a ResultSet.

Characteristic

Description

Syntax

public boolean getMoreResults() throws SQLException

Return

True, if the next result is a ResultSet

False, if the next result is an update count or there are no more results

Note:  getMoreResults implicitly closes any current ResultSet obtained with getResultSet. There are no more results when:

(!getMoreResults() && (getUpdateCount() == -1)

See also: Statement Method execute(String sql).

getMoreResults(int current)

Function: Moves to a Statement’s next result; deals with any current ResultSet object according to the instructions specified by the given flag. It returns true if this result is a ResultSet.

Characteristic

Description

Syntax

public boolean getMoreResults(int current) throws SQLException

where the current parameter is one of the following Statement constants indicating what should happen to current ResultSet objects obtained using the method getResultSet: Statement.CLOSE_CURRENT_RESULT or Statement.KEEP_CURRENT_RESULT

Return

  • True, if the next result is a ResultSet
  • False, if the next result is an update count or there are no more results

Note:  getMoreResults(Statement.KEEP_CURRENT_RESULT) is only supported for Statement with its generated ResultSet type to be ResultSet.TYPE_SCROLL_INSENSITIVE.

ResultSet.TYPE_SCROLL_INSENSITIVE must be specified in order to use Statement.getMoreResults(Statement.KEEP_CURRENT_RESULT), such as in the following method calls:

Connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

Connection.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

Connection.prepareCall(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

Beginning with Teradata Database 12.0, when the application requests the ResultSet type to be ResultSet.TYPE_SCROLL_INSENSITIVE, then the Teradata JDBC Driver is able to quickly and efficiently skip to the next result of a multi-statement request by using cursor positioning to position to the last row of the current result set.

The application must request scrollable result sets to obtain the improved performance when skipping to the next result. If the application requests forward-only result sets, then cursor positioning is not used, and the Teradata JDBC Driver must fetch all rows of the current result set in order to advance to the next result.

getQueryTimeout()

Function: Retrieves the query Timeout limit. The limit is the number of seconds the driver will wait for a Statement to execute.

Characteristic

Description

Syntax

public int getQueryTimeout() throws SQLException

Return

The current query timeout limit in seconds is returned. Zero means unlimited.

Note:  If the limit is exceeded, an SQLException is thrown.

getResultSet()

Function: Returns the current result as a ResultSet. This method should only be called once per result.

Characteristic

Description

Syntax

public ResultSet getResultSet() throws SQLException

Return

The current result as a ResultSet is returned. Null, if the result is an update count or there are no more results.

Note:  See also: Statement Method execute(String sql).

getResultSetConcurrency()

Function: Retrieves the result set concurrency for ResultSet objects generated by this Statement object.

Characteristic

Description

Syntax

public int getResultSetConcurrency() throws SQLException

Return

Either ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE is returned.

Note:  Throws the SQLException if a database access error occurs.

getResultSetHoldability()

Function: Retrieves the result set holdability for ResultSet objects generated by this Statement object.

Characteristic

Description

Syntax

public int getResultSetHoldability() throws SQLException

Return

ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT

Note:   ResultSet.CLOSE_CURSORS_AT_COMMIT is supported beginning with Teradata JDBC Driver 14.00.00.28. Earlier versions of the Teradata JDBC Driver supported only ResultSet.HOLD_CURSORS_OVER_COMMIT.

getUpdateCount()

Function: Returns the current result as an update count.

It should only be called once per result.

Characteristic

Description

Syntax

public int getUpdateCount() throws SQLException

Return

The current result as an update count is returned. A -1 is returned if it is a ResultSet or there are no more results.

Note:  See also execute(String sql).

Beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.25, for row count values received from the database that are too large to fit into a signed 32-bit integer, the Teradata JDBC Driver will return an update count of Integer.MAX_VALUE to the application, and will provide a SQLWarning with error code 1474 that lists the actual row count in the message text.

getWarnings()

Function: The first warning reported by calls on this Statement is returned.

Characteristic

Description

Syntax

public SQLWarning getWarnings() throws SQLException

Return

The first SQL Warning or null is returned.

Note:  A Statement’s execute methods clear its SQLWarning chain. Subsequent Statement warnings will be chained to this SQLWarning. The warning chain is automatically cleared each time a statement is re-executed.

If you are processing a ResultSet, any warnings associated with ResultSet reads will be chained on the ResultSet object.

setFetchDirection(int direction)

Function: Sets the initial fetch direction of the ResultSet objects produced by this Statement after this method is called. Does not affect the fetch direction of ResultSet objects produced previously. Possible values are ResultSet.FETCH_FORWARD or ResultSet.FETCH_REVERSE. The default is ResultSet.FETCH_FORWARD.

Characteristic

Description

Syntax

public void setFetchDirection(int direction) throws SQLException

where the direction parameter is the new fetch direction.

setFetchSize(int rows)

Function: Sets the initial fetch size of the ResultSet objects produced by this Statement after this method is called. Does not affect the fetch size of ResultSet objects produced previously. This functionality is available beginning with Teradata JDBC Driver 13.10.00.25 and Teradata Database 13.10. The default is zero. If the value is zero, then the database decides how many rows to return at a time.

Characteristic

Description

Syntax

public void setFetchSize(int rows) throws SQLException

where the rows parameter is the new fetch size.

setMaxFieldSize(int max)

Function: Sets the maxFieldSize limit in bytes.

Characteristic

Description

Syntax

public void setMaxFieldSize(int max) throws SQLException

where the max parameter is the new maximum column size limit. Zero means unlimited.

Note:  The maxFieldSize is set to limit the size of data that can be returned for any column value. The limit only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields.

If the limit is exceeded, the excess data is discarded. For maximum portability, use values greater than 256.

setMaxRows(int max)

Function: Sets the maxRows limit.

Characteristic

Description

Syntax

public void setMaxRows(int max) throws SQLException

where the max parameter is the new maximum rows limit. Zero means unlimited number of rows.

Note:  MaxRows is set to limit the number of rows that any ResultSet can contain. If the limit is exceeded, the excess rows are dropped.

setQueryTimeout(int seconds)

Function: Sets the queryTimeout limit.

Characteristic

Description

Syntax

public void setQueryTimeout(int seconds) throws SQLException

where the seconds parameter is the new query timeout limit in seconds. Zero means an unlimited number of seconds.

Note:  The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, an SQLException is thrown.

SQLInput Interface

Description

This section describes the Array interface methods. Beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07, the java.sql.SQLInput interface is supported.

An input stream that contains a stream of values representing an instance of an SQL structured type or an SQL distinct type. This interface, used only for custom mapping, is used by the driver behind the scenes, and a programmer never directly invokes SQLInput methods. The reader methods provide a way to read the values in an SQLInput object.

When the method getObject is called with an object of a class implementing the interface SQLData, the JDBC driver calls the method SQLData.getSQLType to determine the SQL type of the user-defined type (UDT) being custom mapped. The driver creates an instance of SQLInput populating it with the attributes of the UDT. The driver then passes the input stream to the method SQLData.readSQL, which in turn calls the SQLInput reader methods in its implementation for reading the attributes from the input stream.

Methods

Supported

readArray()

No

readAsciiStream()

Yes

readBigDecimal()

Yes

readBinaryStream()

Yes

readBlob()

Yes

readBoolean()

No

readByte()

Yes

readBytes()

Yes

readCharacterStream()

Yes

readClob()

Yes

readDate()

Yes

readDouble()

Yes

readFloat()

No

readInt()

Yes

readLong()

Yes

readObject()

Yes

readRef()

No

readShort()

Yes

readSQLXML()

Yes

readString()

Yes

readTime()

Yes

readTimestamp()

Yes

readURL()

No

wasNull()

Yes

Methods

readAsciiStream()

Function: Reads the next attribute in the stream and returns it as a stream of ASCII characters.

Characteristic

Description

Syntax

public InputStream readAsciiStream() throws SQLException

Return

The attribute; if the value is SQL NULL, returns null

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readBigDecimal()

Function: Reads the next attribute in the stream and returns it as a java.math.BigDecimal object.

Characteristic

Description

Syntax

public BigDecimal readBigDecimal() throws SQLException

Return

The attribute; if the value is SQL NULL, returns null

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readBinaryStream()

Function: Reads the next attribute in the stream and returns it as a stream of uninterpreted bytes.

Characteristic

Description

Syntax

public InputStream readBinaryStream() throws SQLException

Return

The attribute; if the value is SQL NULL, returns null

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readBlob()

Function: Reads an SQL BLOB value from the stream and returns it as a Blob object in the Java programming language.

Characteristic

Description

Syntax

public Blob readBlob() throws SQLException

Return

A Blob object representing data of the SQL BLOB value at the head of the stream; if the value is SQL NULL, returns null.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readByte()

Function: Reads the next attribute in the stream and returns it as a byte in the Java programming language.

Characteristic

Description

Syntax

public byte readByte() throws SQLException

Return

The attribute; if the value is SQL NULL, returns 0.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readBytes()

Function: Reads the next attribute in the stream and returns it as an array of bytes in the Java programming language.

Characteristic

Description

Syntax

public byte[] readBytes() throws SQLException

Return

The attribute; if the value is SQL NULL, returns null.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readCharacterStream()

Function: Reads the next attribute in the stream and returns it as a stream of Unicode characters.

Characteristic

Description

Syntax

public Reader readCharacterStream() throws SQLException

Return

The attribute; if the value is SQL NULL, returns null.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readClob()

Function: Reads an SQL CLOB value from the stream and returns it as a Clob object in the Java programming language.

Characteristic

Description

Syntax

public Clob readClob() throws SQLException

Return

A Clob object representing data of the SQL CLOB value at the head of the stream; if the value is SQL NULL, returns null.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readDate()

Function: Reads the next attribute in the stream and returns it as a java.sql.Date object.

Characteristic

Description

Syntax

public Date readDate() throws SQLException

Return

The attribute; if the value is SQL NULL, returns null.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readDouble()

Function: Reads the next attribute in the stream and returns it as a double in the Java programming language.

Characteristic

Description

Syntax

public double readDouble() throws SQLException

Return

The attribute; if the value is SQL NULL, returns 0.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readInt()

Function: Reads the next attribute in the stream and returns it as an int in the Java programming language.

Characteristic

Description

Syntax

public int readInt() throws SQLException

Return

The attribute; if the value is SQL NULL, returns 0.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readLong()

Function: Reads the next attribute in the stream and returns it as a long in the Java programming language.

Characteristic

Description

Syntax

public long readLong() throws SQLException

Return

The attribute; if the value is SQL NULL, returns 0.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readObject()

Function: Reads the datum at the head of the stream and returns it as an Object in the Java programming language.

Characteristic

Description

Syntax

public Object readObject() throws SQLException

Return

The datum at the head of the stream as an Object in the Java programming language; if the value is SQL NULL, returns null.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readShort()

Function: Reads the next attribute in the stream and returns it as a short in the Java programming language.

Characteristic

Description

Syntax

public short readShort() throws SQLException

Return

The attribute; if the value is SQL NULL, returns 0.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readSQLXML()

Function: Reads a SQL XML value from the stream and returns it as a SQLXML object in the Java programming language.

Characteristic

Description

Syntax

public SQLXML readSQLXML() throws SQLException

Return

A SQLXML object representing data of the SQL XML value at the head of the stream; null if the value read is SQL NULL.

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

readString()

Function: Reads the next attribute in the stream and returns it as a String in the Java programming language.

Characteristic

Description

Syntax

public String readString() throws SQLException

Return

The attribute; if the value is SQL NULL, returns null.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readTime()

Function: Reads the next attribute in the stream and returns it as a java.sql.Time object.

Characteristic

Description

Syntax

public Time readTime() throws SQLException

Return

The attribute; if the value is SQL NULL, returns null.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

readTimestamp()

Function: Reads the next attribute in the stream and returns it as a java.sql.Timestamp object.

Characteristic

Description

Syntax

public Timestamp readTimestamp() throws SQLException

Return

The attribute; if the value is SQL NULL, returns null.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

wasNull()

Function: Retrieves whether the last value read was SQL NULL.

Characteristic

Description

Syntax

public boolean wasNull() throws SQLException

Return

A true if the most recently read SQL value was SQL NULL; a false otherwise.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

SQLOutput Interface

Description

This section describes the Array interface methods. Beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07, the java.sql.SQLOutput interface is supported.

The 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 method SQLData.getSQLType to determine the kind of SQL datum being passed to the database. The driver then creates an instance of SQLOutput and passes it to the method SQLData.writeSQL. The method writeSQL in turn calls the appropriate SQLOutput writer methods to write data from the SQLData object to the SQLOutput output stream as the representation of an SQL user-defined type.

Methods

Supported

writeArray(Array x)

No

writeAsciiStream(InputStream x)

Yes

writeBigDecimal(BigDecimal x)

Yes

writeBinaryStream(InputStream x)

Yes

writeBlob(Blob x)

Yes

writeBoolean(Boolean x)

No

writeByte(byte x)

Yes

writeBytes(byte[] x)

Yes

writeCharacterStream(Reader x)

Yes

writeClob(Clob x)

Yes

writeDate(Date x)

Yes

writeDouble(double x)

Yes

writeFloat(float x)

No

writeInt(int x)

Yes

writeLong(long x)

Yes

writeObject(SQLData x)

Yes

writeRef(Ref x)

No

writeShort(Short x)

Yes

writeSQLXML(SQLXML x)

Yes

writeString(String x)

Yes

writeStruct(Struct x)

Yes

writeTime(Time x)

Yes

writeTimestamp(Timestamp x)

Yes

writeURL(URL x)

No

Methods

writeAsciiStream()

Function: Writes the next attribute to the stream as a stream of ASCII characters.

Characteristic

Description

Syntax

public void writeAsciiStream(InputStream x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeBigDecimal()

Function: Writes the next attribute to the stream as a java.math.BigDecimal object.

Characteristic

Description

Syntax

public void writeBigDeicmal(BigDecimal x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeBinaryStream()

Function: Writes the next attribute to the stream as a stream of uninterpreted bytes.

Characteristic

Description

Syntax

public void writeBinaryStream(InputStream x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeBlob()

Function: Writes an SQL BLOB value to the stream.

Characteristic

Description

Syntax

public void writeBlob(Blob x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeByte()

Function: Writes the next attribute to the stream as a Java byte.

Characteristic

Description

Syntax

public void writeByte(byte x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeBytes()

Function: Writes the next attribute to the stream as an array of bytes.

Characteristic

Description

Syntax

public void writeBytes(byte[] x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeCharacterStream()

Function: Writes the next attribute to the stream as a stream of Unicode characters.

Characteristic

Description

Syntax

public void writeCharacterStream(Reader x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeClob()

Function: Writes an SQL CLOB value to the stream.

Characteristic

Description

Syntax

public void writeClob(Clob x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeDate()

Function: Writes the next attribute to the stream as a java.sql.Date object.

Characteristic

Description

Syntax

public void writeDate(Date x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeDouble()

Function: Writes the next attribute to the stream as a Java double.

Characteristic

Description

Syntax

public void writeDouble(double x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeInt()

Function: Writes the next attribute to the stream as a Java int.

Characteristic

Description

Syntax

public void writeInt(int x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeLong()

Function: Writes the next attribute to the stream as a Java long.

Characteristic

Description

Syntax

public void writeLong(long x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeObject()

Function: Writes to the stream the data contained in the given SQLData object.

Characteristic

Description

Syntax

public void writeObject(Object x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeShort()

Function: Writes the next attribute to the stream as a Java short.

Characteristic

Description

Syntax

public void writeShort(short x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeSQLXML()

Function: Writes a SQL XML value to the stream.

Characteristic

Description

Syntax

public void writeSQLXML(SQLXML x) throws SQLException

where the x parameter is a SQLXML object representing data of a SQL XML value.

Note:  This method is supported beginning with Teradata Database 14.10 and Teradata JDBC Driver 14.00.00.19.

JDK 6.0 or later is required to use SQLXML functionality.

writeString()

Function: Writes the next attribute to the stream as a String in the Java programming language.

Characteristic

Description

Syntax

public void writeString(String x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeStruct()

Function: Writes an SQL structured type value to the stream.

Characteristic

Description

Syntax

public void writeStruct(Struct x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeTime()

Function: Writes the next attribute to the stream as a java.sql.Time object.

Characteristic

Description

Syntax

public void writeTime(Time x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

writeTimestamp()

Function: Writes the next attribute to the stream as a java.sql.Timestamp object.

Characteristic

Description

Syntax

public void writeTimestamp(Timestamp x) throws SQLException

where the x parameter represents the value to pass to the database.

Note:  This method is available beginning with Teradata Database 13.10 and Teradata JDBC Driver 13.10.00.07.

Struct Interface

Description

The 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.

The Teradata JDBC Driver uses Struct values to represent Period data values.

Methods

Supported

getAttributes()

Yes

getAttributes(Map map)

Yes

getSQLTypeName()

Yes

Methods

getAttributes()

Function: Produces the ordered values of the attributes of the SQL structured type that this Struct object represents.

Characteristic

Description

Syntax

public Object [] getAttributes() throws SQLException

Return

An array containing the ordered attribute values.

Note:  This method is only supported when connected to Teradata Database 13.10 or later.

This method uses the type map associated with the connection for JDBC custom type mapping of attributes of Struct objects received from the database. A Struct object created by the Connection createStruct method is not subject to JDBC custom type mapping.

getAttributes(Map map)

Function: Produces the ordered values of the attributes of the SQL structured type that this Struct object represents.

Characteristic

Description

Syntax

public Object [] getAttributes(Map map) throws SQLException

where the map parameter specifies a mapping of SQL type names to Java classes.

Return

An array containing the ordered attribute values.

Note:  This method is only supported when connected to Teradata Database 13.10 or later.

This method uses the specified type map for JDBC custom type mapping of attributes of Struct objects received from the database. A Struct object created by the Connection createStruct method is not subject to JDBC custom type mapping.

getSQLTypeName()

Function: Retrieves the SQL type name of the SQL structured type that this Struct object represents.

Characteristic

Description

Syntax

public String getSQLTypeName() throws SQLException

Return

The fully-qualified type name of the SQL structured type for which this Struct object is the generic representation.

Note:  This method is only supported when connected to Teradata Database 13.10 or later.

When used with Period data types, the SQL type name of the Period data type is returned.

TeraConnectionPoolDataSource Class

Description

A ConnectionPoolDataSource is an alternative to the DriverManager facility for creating database connections. A ConnectionPoolDataSource is typically used by an application running inside an application server. An application running inside an application server typically uses the Java Naming and Directory (JNDI) API to look up and obtain a reference to a ConnectionPoolDataSource object.

TeraConnectionPoolDataSource implements javax.sql.ConnectionPoolDataSource, and provides the same connection parameter getter and setter methods as TeraDataSource.

The available properties correspond to the URL parameters used with the DriverManager getConnection method. Additional information about them can be found in Making a Database Connection.

This section describes only the properties provided by TeraConnectionPoolDataSource that are in addition to the methods provided by TeraDataSource. The TeraConnectionPoolDataSource class supports several properties defined by the JDBC 3.0 specification, to assist an application server in managing a connection pool. These properties do not govern any behavior of the Teradata JDBC Driver. The Teradata JDBC Driver simply stores and retrieves the property values when a TeraConnectionPoolDataSource is serialized.

Methods

Supported

getInitialPoolSize()

Yes

getMaxIdleTime()

Yes

getMaxPoolSize()

Yes

getMaxStatements()

Yes

getMinPoolSize()

Yes

getPropertyCycle()

Yes

setInitialPoolSize(int poolsize)

Yes

setMaxIdleTime(int maxIdleTime)

Yes

setMaxPoolSize(int maxPoolSize)

Yes

setMaxStatements(int maxStatements)

Yes

setMinPoolSize(int minPoolSize)

Yes

setPropertyCycle(int propertyCycle)

Yes

Methods

getInitialPoolSize()

Function: Gets the number of physical connections the pool should contain when it is created.

Characteristic

Description

Syntax

public int getInitialPoolSize()

Return

The number of connections is returned.

getMaxIdleTime()

Function: Gets the number of seconds that a physical connection should remain unused in the pool before the connection is closed. If zero, there is no limit.

Characteristic

Description

Syntax

public int getMaxIdleTime()

Return

The number of seconds is returned.

getMaxPoolSize()

Function: Gets the maximum number of physical connections that the pool should contain. A zero indicates that there is no maximum size.

Characteristic

Description

Syntax

public int getMaxPoolSize()

Return

The number of connections is returned.

getMaxStatements()

Function: Gets the total number of statements that the pool should keep open. A zero indicates that the caching of statements is disabled.

Characteristic

Description

Syntax

public int getMaxStatements()

Return

The number of statements that the pool should keep open is returned.

getMinPoolSize()

Function: Gets the number of physical connections the pool should keep available at all times. A zero indicates that connections are to be created as needed.

Characteristic

Description

Syntax

public int getMinPoolSize()

Return

The number of connections is returned.

getPropertyCycle()

Function: Gets the interval, in seconds, that the pool should wait before enforcing the current policy defined by the values of the other connection pool properties.

Characteristic

Description

Syntax

public int getPropertyCycle()

Return

The number of seconds is returned.

setInitialPoolSize()

Function: Sets the initial pool size.

Characteristic

Description

Syntax

public void setInitialPoolSize(int poolsize)

where poolsize is the number of physical connections the pool should contain when it is created

setMaxIdleTime()

Function: Sets the maximum idle time.

Characteristic

Description

Syntax

public void setMaxIdleTime(int maxIdleTime)

where maxIdleTime is the number of seconds that a physical connection should remain unused in the pool before the connection is closed. A zero indicates that there is no limit.

setMaxPoolSize()

Function: Sets the maximum pool size.

Characteristic

Description

Syntax

public void setMaxPoolSize(int maxPoolSize)

where maxPoolSize is the maximum number of physical connections that the pool should contain. A zero indicates that there is no maximum size.

setMaxStatements()

Function: Sets the maximum number of statements.

Characteristic

Description

Syntax

public void setMaxStatements(int maxStatements)

where maxStatements is the total number of statements that the pool should keep open. A zero indicates that caching of statements is disabled.

setMinPoolSize()

Function: Sets the minimum pool size.

Characteristic

Description

Syntax

public void setMinPoolSize(int minPoolSize)

where minPoolSize is the number of physical connections the pool should keep available at all times. A zero indicates that connections should be created as needed.

setPropertyCycle()

Function: Sets the property cycle value.

Characteristic

Description

Syntax

public void setPropertyCycle(int propertyCycle)

where propertyCycle is the interval, in seconds, that the pool should wait before enforcing the current policy defined by the values of the other connection pool properties.

TeraDataSource Class

Description

A DataSource is an alternative to the DriverManager facility for creating database connections. A DataSource is typically used by an application running inside an application server. An application running inside an application server typically uses the Java Naming and Directory (JNDI) API to look up and obtain a reference to a DataSource object.

TeraDataSource implements javax.sql.DataSource. TeraConnectionPoolDataSource implements javax.sql.ConnectionPoolDataSource, and provides the same connection parameter getter and setter methods as TeraDataSource.

The main difference between TeraConnectionPoolDataSource and TeraDataSource is that the first will return pooled connections while the latter will not. All the properties specified for TeraDataSource are also necessary for TeraConnectionPoolDataSource.

The available properties correspond to the URL parameters used with the DriverManager getConnection method. Additional information about them can be found in Making a Database Connection.

Warning:  

As the database doesn't provide any means to "reset" a connection, the user of a connection pool data source must be aware that any commands that affect the session defaults must not be used as the new defaults will then be in effect for the next unsuspecting user of that connection.

The session parameters that MUST NOT BE CHANGED include:

Methods

Supported

getACCOUNT()

Yes

getCHARSET()

Yes

getCOMPAT_DBS()

Yes

getCOMPAT_GETSCHEMA()

Yes

getCOMPAT_GETTABLE()

Yes

getCOMPAT_ISAUTOINC()

Yes

getCOMPAT_ISCURRENCY()

Yes

getCOMPAT_ISDEFWRIT()

Yes

getCOMPAT_ISREADONLY()

Yes

getCOMPAT_ISSEARCH()

Yes

getCOMPAT_ISSIGNED()

Yes

getCOMPAT_ISWRITABLE()

Yes

getConnection()

Yes

getConnection(String username, String password)

Yes

getDatabaseName()/getDATABASE()

Yes

getDataSourceName()

Yes

getDBS_PORT()

Yes

getDescription()

Yes

getDSName()

Yes

getENCRYPTDATA

Yes

getLOB_SUPPORT()

Yes

getLOB_TEMP_TABLE()

Yes

getLOG()

Yes

getLoginTimeout()

Yes

getLOGDATA()

Yes

getLOGMECH()

Yes

getLogWriter()

Yes

getPassword()

Yes

getServerName() (deprecated)

No

getSP_SPL()

Yes

getTMODE()

Yes

getTNANO()

Yes

getTSNANO()

Yes

getUser()

Yes

getUSEXVIEWS()

Yes

setACCOUNT(String accountId)

Yes

setCHARSET(String charset)

Yes

setCOMPAT_DBS(String compatVal)

Yes

setCOMPAT_GETSCHEMA(String compatVal)

Yes

setCOMPAT_GETTABLE(String compatVal)

Yes

setCOMPAT_ISAUTINC(String compatVal)

Yes

setCOMPAT_ISCURRENCY(String compatVal)

Yes

setCOMPAT_ISDEFWRIT(String compatVal)

Yes

setCOMPAT_ISREADONLY(String compatVal)

Yes

setCOMPAT_ISSEARCH(String compatVal)

Yes

setCOMPAT_ISSIGNED(String compatVal)

Yes

setCOMPAT_ISWRITABLE(String compatVal)

Yes

setDatabaseName(String database)/setDATABASE(String database)

Yes

setDataSourceName(String datasourceName)

Yes

setDBS_PORT(String dbsport)

Yes

setDescription(String description)

Yes

setDSName(String DSName)

Yes

setENCRYPTDATA(String encryptdata)

Yes

setLOB_SUPPORT(String lobSupport)

Yes

setLOB_TEMP_TABLE(String lobTempTable)

Yes

setLOG(String logValue)

Yes

setLOGDATA(String logData)

Yes

setLoginTimeout(int seconds)

Yes

setLOGMECH(String logMech)

Yes

setLogWriter(java.io.PrintWriter out)

Yes

setPassword(String password)

Yes

setServerName(String serverName) (deprecated)

No

setSP_SPL(String splVal)

Yes

setTMODE(String tmodeVal)

Yes

setTNANO(String tnanoVal)

Yes

setTSNANO(String tsnanoVal)

Yes

setUser(String user)

Yes

setUSEXVIEWS(String useXViews)

Yes

Methods

getACCOUNT()

Function: Gets the accountId. It returns the name of the account to be charged.

Characteristic

Description

Syntax

public String getACCOUNT()

Note:  The getAccount and getAccountId methods are deprecated. Use the getACCOUNT method instead.

getCHARSET()

Function: Get the session character set.

Characteristic

Description

Syntax

public String getCHARSET()

Return

The character set is returned.

getCOMPAT_DBS()

Function: Get the COMPAT_DBS value.

Characteristic

Description

Syntax

public String getCOMPAT_DBS()

Return

The COMPAT_DBS value is returned.

getCOMPAT_GETSCHEMA()

Function: Get the COMPAT_GETSCHEMA value.

Characteristic

Description

Syntax

public String getCOMPAT_GETSCHEMA()

Return

The COMPAT_GETSCHEMA value is returned.

getCOMPAT_GETTABLE()

Function: Get the COMPAT_GETTABLE value.

Characteristic

Description

Syntax

public String getCOMPAT_GETTABLE()

Return

The COMPAT_GETTABLE value is returned.

getCOMPAT_ISAUTOINC()

Function: Get the COMPAT_ISAUTOINC value.

Characteristic

Description

Syntax

public String getCOMPAT_ISAUTOINC()

Return

The COMPAT_ISAUTOINC value is returned.

getCOMPAT_ISCURRENCY()

Function: Get the COMPAT_ISCURRENCY value

Characteristic

Description

Syntax

public String getCOMPAT_ISCURRENCY()

Return

The COMPAT_ISCURRENCY value is returned.

getCOMPAT_ISDEFWRIT()

Function: Get the COMPAT_ISDEFWRIT value.

Characteristic

Description

Syntax

public String getCOMPAT_ISDEFWRIT()

Return

The COMPAT_ISDEFWRIT value is returned.

getCOMPAT_ISREADONLY()

Function: Get the COMPAT_ISREADONLY value.

Characteristic

Description

Syntax

public String getCOMPAT_ISREADONLY()

Return

The COMPAT_ISREADONLY value is returned.

getCOMPAT_ISSEARCH()

Function: Get the COMPAT_ISSEARCH value.

Characteristic

Description

Syntax

public String getCOMPAT_ISSEARCH()

Return

The COMPAT_ISSEARCH value is returned.

getCOMPAT_ISSIGNED()

Function: Get the COMPAT_ISSIGNED value.

Characteristic

Description

Syntax

public String getCOMPAT_ISSIGNED()

Return

The COMPAT_ISSIGNED value is returned.

getCOMPAT_ISWRITABLE()

Function: Get the COMPAT_ISWRITABLE value.

Characteristic

Description

Syntax

public String getCOMPAT_ISWRITABLE()

Return

The COMPAT_ISWRITABLE value is returned.

getConnection()

Function: Attempt to establish a database connection.

Characteristic

Description

Syntax

public java.sql.Connection getConnection() throws java.sql.SQLException

Return

A connection to the database is returned.

getConnection(String username, String password)

Function: Attempt to establish a database connection.

Characteristic

Description

Syntax

public java.sql.Connection getConnection(String username, String password) throws java.sql.SQLException

where the parameter:

  • username is the database user on whose behalf the Connection is being made
  • password is the user’s password

Return

A connection to the database is returned.

getDatabaseName()/getDATABASE()

Function: Get the Default Database name. This returns the name of the default database that will be set at logon time.

Characteristic

Description

Syntax

public String getDatabaseName()

Return

The default database name is returned.

getDataSourceName()

Function: Get the name of this datasource.

Characteristic

Description

Syntax

public String getDataSourceName()

Return

The datasource name or null is returned.

getDBS_PORT()

Function: Get the DBS_PORT value. This specifies the TCP/IP port used to access the database.

Characteristic

Description

Syntax

public String getDBS_PORT()

Return

The DBS_PORT value is returned.

getDescription()

Function: Get the description of the DataSource.

Characteristic

Description

Syntax

public String getDescription()

Return

A description is returned.

getDSName()

Function: Get the Database Server name. This returns the name of the server running the database.

Characteristic

Description

Syntax

public String getDSName()

Return

The Database Server name is returned.

getENCRYPTDATA()

Function: Get the EncryptData flag.

Characteristic

Description

Syntax

public String getENCRYPTDATA()

Return

ON–When set to ON, data sent between the Teradata JDBC Driver and the database are encrypted. This provides greater security, although performance will be affected.

OFF–When set to OFF, data sent between the Teradata JDBC Driver and the database are not encrypted.

Note:  The setLOGMECH(String logMECH) method determines which encryption method will be available and whether or not Single Sign-on is supported. The setENCRYPTDATA(String encryptData) determines whether or not data is encrypted on the connection.

getLOB_SUPPORT()

Function: Get the LOB_SUPPORT value.

Characteristic

Description

Syntax

public String getLOB_SUPPORT()

Return

The LOB_SUPPORT value is returned.

getLOB_TEMP_TABLE()

Function: Gets the LOB_TEMP_TABLE value.

Characteristic

Description

Syntax

public String getLOB_TEMP_TABLE()

Return

The tableName used for Updatable Lobs is returned.

getLOG()

Function: Get the LOG value.

Characteristic

Description

Syntax

public String getLOG()

Return

The LOG value is returned.

getLoginTimeout()

Function: Get the Login Timeout.

Characteristic

Description

Syntax

public int getLoginTimeout() throws java.sql.SQLException

Return

The login timeout is returned.

getLOGDATA()

Function: Get the LogData value.

Characteristic

Description

Syntax

public String getLOGDATA()

Return

The LogData value or null is returned.

getLOGMECH()

Function: Get the Logon Mechanism value.

Characteristic

Description

Syntax

public String getLOGMECH()

Return

The Logon Mechanism or null is returned.

getLogWriter()

Function: Get the Log File name.

Characteristic

Description

Syntax

public java.io.PrintWriter getLogWriter()

Return

The log file name is returned.

getPassword()

Function: Get the password used for DBS access.

Characteristic

Description

Syntax

public String getPassword()

Return

The password is returned.

getServerName()

Function: This function has been deprecated. Get the Teradata JDBC gateway Server name. getServerName will log an error message, but will not throw an exception.

Characteristic

Description

Syntax

public String getServerName()

Return

The server name is returned.

getSP_SPL()

Function: Get the SP_SPL value.

Characteristic

Description

Syntax

public String getSP_SPL()

Return

The SP_SPL value is returned.

getTMODE

Function: Get the Transaction Mode value.

Characteristic

Description

Syntax

public String getTMODE()

Return

The Transaction Mode value is returned.

getTNANO()

Function: Get the TNANO value.

Characteristic

Description

Syntax

public String getTNANO()

Return

The TNANO value is returned.

getTSNANO()

Function: Get the TSNANO value.

Characteristic

Description

Syntax

public String getTSNANO()

Return

The TSNANO value is returned.

getUser()

Function: Get the user name used for DBS access.

Characteristic

Description

Syntax

public String getUser()

Return

The user name is returned.

getUSEXVIEWS()

Function: Gets the USEXVIEWS value.

Characteristic

Description

Syntax

public String getUSEXVIEWS()

Return

The USEXVIEWS value is returned.

setACCOUNT(String accountId)

Function: Sets the accountId.

Characteristic

Description

Syntax

public void setACCOUNT(String accountId)

where the accountId parameter is the accountId value. This sets the name of the account to be charged.

Note:  The setAccount and setAccountId methods are deprecated. Use the setACCOUNT method instead.

setCHARSET(String charset)

Function: Set the session character set.

Characteristic

Description

Syntax

public void setCHARSET(String charset)

where the charset parameter is ASCII, KANJISJIS_OS, or KANJIEUC_0U

setCOMPAT_DBS()

Function: Set the COMPAT_DBS value.

Characteristic

Description

Syntax

public void setCOMPAT_DBS(String compatVal)

where the compatValue parameter is COMPAT_DBS value

setCOMPAT_GETSCHEMA()

Function: Set the COMPAT_GETSCHEMA value.

Characteristic

Description

Syntax

public void setCOMPAT_SCHEMA(String compatVal)

where the compatValue parameter is COMPAT_SCHEMA value

setCOMPAT_GETTABLE()

Function: Set the COMPAT_GETTABLE value.

Characteristic

Description

Syntax

public void setCOMPAT_GETTABLE(String compatVal)

where the compatValue parameter is GETTABLE value

setCOMPAT_ISAUTOINC()

Function: Set the COMPAT_ISAUTOINC value.

Characteristic

Description

Syntax

public void setCOMPAT_ISAUTOINC(String compatVal)

where the compatValue parameter is COMPAT_ISAUTOINC value

setCOMPAT_ISCURRENCY()

Function: Set the COMPAT_ISCURRENCY value.

Characteristic

Description

Syntax

public void setCOMPAT_ISCURRENCY(String compatVal)

where the compatValue parameter is COMPAT_ISCURRENCY value

setCOMPAT_ISDEFWRIT()

Function: Set the COMPAT_ISDEFWRIT value.

Characteristic

Description

Syntax

public void setCOMPAT_ISDEFWRIT(String compatVal)

where the compatValue parameter is COMPAT_ISDEFWRIT value

setCOMPAT_ISREADONLY()

Function: Set the COMPAT_ISREADONLY value.

Characteristic

Description

Syntax

public void setCOMPAT_ISREADONLY(String compatVal)

where the compatValue parameter is COMPAT_ISREADONLY value

setCOMPAT_ISSEARCH()

Function: Set the COMPAT_ISSEARCH value.

Characteristic

Description

Syntax

public void setCOMPAT_ISSEARCH(String compatVal)

where the compatValue is COMPAT_ISSEARCH value

setCOMPAT_ISSIGNED()

Function: Set the COMPAT_ISSIGNED value.

Characteristic

Description

Syntax

public void setCOMPAT_ISSIGNED(String compatVal)

where the compatValue parameter is COMPAT_ISSIGNED value

setCOMPAT_ISWRITABLE()

Function: Set the COMPAT_ISWRITABLE value.

Characteristic

Description

Syntax

public void setCOMPAT_ISWRITABLE(String compatVal)

where the compatValue parameter is COMPAT_ISWRITABLE value

setDatabaseName(String database)/setDATABASE(String database)

Function: Set the Default Database name. This sets the name of the default database that will be set at logon time.

Characteristic

Description

Syntax

public void setDatabaseName(String database)

where the database parameter is the name of database to access at logon

setDataSourceName(String dataSourceName)

Function: Set the name of this datasource.

Characteristic

Description

Syntax

public void setDataSourceName(String dataSourceName)

where the DataSourceName parameter is name of datasource to access at logon

setDBS_PORT(String dbsport)

Function: Set the DBS_PORT value.

Characteristic

Description

Syntax

public void setDBSPORT(String dbsport)

where the dbsport parameter is TCP/IP port number of the database

setDescription(String description)

Function: Set the description of the DataSource.

Characteristic

Description

Syntax

public void setDescription(String description)

where the description parameter is the description of DataSource

setDSName(String DSName)

Function: Set the Database Server name. This sets the name of the server running the database.

Characteristic

Description

Syntax

public void setDSName(String DSName)

where the DSName parameter is the Database Server name

setENCRYPTDATA(String encryptData)

Function: Set the EncryptData flag. This flag determines whether data is encrypted on this connection.

Characteristic

Description

Syntax

public void setENCRYPTDATA(String encryptData)

where the encryptData parameter is:

ON–When set to ON, data sent between the Teradata JDBC Driver and the database are encrypted. This provides greater security, although performance will be affected.

OFF–When set to OFF, data sent between the Teradata JDBC Driver and the database are not encrypted.

Note:  The setLOGMECH(String logMECH) method determines which encryption method will be available and whether or not Single Sign-on is supported. The setENCRYPTDATA(String encryptData) method determines whether or not data is encrypted on the connection.

setLOB_SUPPORT(String lobSupport)

Function: Set the LOB_SUPPORT value.

Characteristic

Description

Syntax

public void setLOB_SUPPORT(String lobSupport)

where the lobSupport parameter is the lobSupport value

setLOB_TEMP_TABLE(String)

Function: Set the LOB_TEMP_TABLE value.

Characteristic

Description

Syntax

public void setLOB_TEMP_TABLE(String lobTempTable)

where the lobTempTable parameter is the tableName or databaseName.tableName used for Updatable Lobs

setLOG(String lobSupport)

Function: Set the LOG value.

Characteristic

Description

Syntax

public void setLOG(String logValue)

where the logValue parameter is the LOG value–ERROR, INFO, or DEBUG

setLOGDATA(String logData)

Function: Set the Logon Data. This value can be used to pass mechanism-specific data to the mechanisms such as authorization tokens or domain/realm information.

Characteristic

Description

Syntax

public void setLOGDATA(String LogData)

where the LogData parameter is mechanism-specific data to the mechanisms such as authorization tokens or domain/realm information:

  • Teradata Method 1–unused
  • Teradata Method 2–unused
  • Browser–unused
  • JWT–contains token= followed by the JSON Web Token
  • Kerberos–can contain Kerberos username, instance, and realm. Use is optional.
  • LDAP–contains the Distinguished Name to be used
  • TDNEGO–contains any of the above valid tokens

 

JWT example:

token=dHkiOiJKV1QiLCJoI2tGIS42 ...

 

 

Kerberos example:

user1@ESDOM.ESDEV.TDAT@@mypassword

 

LDAP example 1:

authcid=username password=userpassword

 

LDAP example 2:

username@@userpassword

setLoginTimeout(int seconds)

Function: Set the Login Timeout.

Characteristic

Description

Syntax

public void setLoginTimeout(int seconds) throws java.sql.SQLException

where the seconds parameter is the Login Timeout value

setLOGMECH(String LogMech)

Function: Set the Logon Mechanism. The mechanism determines the level of security used on the connection and whether or not Single Sign-on is supported.

Characteristic

Description

Syntax

public void setLOGMECH(String LogMech)

where the LogMech parameter is the mechanism to use:

  • TD1–Teradata Method 1
  • TD2–Teradata Method 2
  • BROWSER–Browser Authentication
  • JWT–JSON Web Token
  • KRB5–Kerberos
  • LDAP–Lightweight Directory Access Protocol
  • TDNEGO–Teradata Negotiated Mechanism

setLogWriter(java.io.PrintWriter out)

Function: Set the Log File name.

Characteristic

Description

Syntax

public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException

where the out parameter is the log file name

setPassword(String password)

Function: Set the password used for DBS access.

Characteristic

Description

Syntax

public void setPassword(String password)

where the password parameter is the password for the database user.

setServerName(String serverName)

Function: This function has been deprecated. Set the Teradata JDBC gateway Server name. setServerName will log an error message, but will not throw an exception.

Characteristic

Description

Syntax

public void setServerName(String serverName)

where the ServerName parameter is the Server name

setSP_SPL(String splVal)

Function: Set the value of Stored Procedure spl option.

Characteristic

Description

Syntax

public void setSP_SPL(String splVal)

where the splVal parameter is the SPL value

setTMODE(String tmodeVal)

Function: Set the TMODE value.

Characteristic

Description

Syntax

public void setTMODE(String tmodeVal)

  • where the tmodeVal parameter is the TMODE value
  • where the TransactMode parameter is ANSI, TERA, or DEFAULT

setTNANO(String tnanoVal)

Function: Set the TNANO value.

Characteristic

Description

Syntax

public void setTNANO(String tnanoVal)

where the tnanoVal parameter is the TNANO value

setTSNANO(String tsnanoVal)

Function: Set the TSNANO value.

Characteristic

Description

Syntax

public void setTSNANO(String tsnanoVal)

where the tsnanoVal is the TSNANO value

setUser(String user)

Function: Set the user name used for DBS access.

Characteristic

Description

Syntax

public void setUser(String user)

where the user parameter is the user name for DBS access.

setUSEXVIEWS(String useXviews)

Function: Configures the Connection to use or not use X_views when retrieving Database Metadata.

Characteristic

Description

Syntax

public void setUSEXVIEWS(String useXviews)

where

  • useXviews ON – DatabaseMetaData calls use X-views rather than non-X-views to retrieve data. This provides greater control over what information can be accessed, though the use of X-views has a negative impact on performance.
  • useXviews OFF – DatabaseMetaData calls use non-X-views rather than X-views to retrieve data. The setting of USEXVIEWS to OFF is the default setting for a Connection.