Previous Next Contents Index


IError interface (deprecated)

IError is deprecated and is provided for backward compatibility only. New applications should use JDBC exceptions instead. For example, the java.sql package provides exceptions such as BatchUpdateException, DataTruncation, SQLException, and SQLWarning.

The IError interface represents an error code object that consists of a code and a corresponding error message that originates from a facility, such as an operating system or a database. In this release, IError handles database errors only.

Use the methods in the IError interface to get error codes and messages returned by a database.

The IErrorinterface is implemented by the IDataConn object. To use it, cast IDataConn to the IError interface, as shown in the following example:

IDataConn conn;

conn = createDataConn(...);
IError error;
error = (IError) conn;
Package
com.kivasoft

Methods
Method
Description
getErrorCode( )
Returns the current error code as a string.
getErrorCodeNum( )
Returns the current error code as a number.
getErrorMessage( )
Returns the message associated with the current error code.
getErrorFacility( )
Returns a description of the facility that generated an error code.

getErrorCode( )
Returns the current error code as a string.

Syntax
public String getErrorCode()
Usage
Use getErrorCode( ) after a database operation, such as running a stored procedure or executing a query, to retrieve the error code for debugging or error-handling purposes. The following is an example of a returned error code: "ORA-03130".

Tip
For ODBC, the error codes usually consist of the ODBC error code and the database error code separated by a space, for example, "S1000 1017". Sometimes just the ODBC error code, such as "S1000", is returned.

Return Value
The current error code as a string.

Related Topics
getErrorCodeNum( )

getErrorMessage( )

getErrorFacility( )

getErrorCodeNum( )
Returns the current error code as a number.

Syntax
public int getErrorCodeNum()
Usage
Use getErrorCodeNum( ) after a database operation, such as running a stored procedure or executing a query, to retrieve the error code for debugging or error-handling purposes.

Return Value
The current error code as a number. If the error code cannot be converted to a number, getErrorCodeNum( ) returns null. For example, an error code that contains letters, such as "S1000", cannot be converted to a number.

Related Topics
getErrorCode( )

getErrorMessage( )

getErrorFacility( )

getErrorMessage( )
Returns the message associated with the current error code.

Syntax
public String getErrorMessage(
	String pCode)

pCode. Specify any string.

Usage
Use getErrorMessage( ) after a database operation, such as running a stored procedure or executing a query, to retrieve the message associated with the current error code. The AppLogic can then display the message to users. The following is an example of a returned error message: "[ODBC][Visigenic driver][S1000]Connection attempt failed".

Return Value
The message associated with the current error code.

Related Topics
getErrorCode( )

getErrorCodeNum( )

getErrorFacility( )

getErrorFacility( )
Returns a description of the facility that generated an error code.

Syntax
public String getErrorFacility()
Usage
Use getErrorFacility( ) after a database operation, such as running a stored procedure or executing a query, to get information on which driver generated the current error code. The following is an example of a description returned by getErrorFacility( ): "ODBC DAD".

Return Value
The description of the facility that generated the current error code.

Related Topics
getErrorCode( )

getErrorCodeNum( )

getErrorMessage( )

 

© Copyright 1999 Netscape Communications Corp.