Oracle Objects for OLE C++ Class Library
Release 9.2

Part Number A95896-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

GetServerErrorText Method

Applies To

OSession

ODatabase

Description

This method returns a text description of the most recent Oracle error in this session.

Usage

const char *GetServerErrorText(void) const

Remarks

This method returns the Oracle error message text for the most recent server error, if available. The error message contains an Oracle error number and may contain a brief description of the problem. Errors that occur while opening a database or in a transactional method will be reported on the session. Other errors are reported on the database.

The string returned is owned by the object. The caller should not free it; it will be freed when the object is destroyed, closed, the error is reset with ServerErrorReset, or another call is made to GetServerErrorText.

Return Value

A valid, null terminated const char pointer on success; NULL on failure.

Example

An example of a server error:

// open an ODatabase object

ODatabase odb("ExampleDB", "scott", "tiger");

if (! odb.IsOpen())

{ // Failed to open the database

OSession tempsess = odb.GetSession();

ErrorMessage(tempsess.GetServerErrorText());

}

// try to open a dynaset with a bad column name

ODynaset dyn(odb, "select xx from emp");

// if that didn't work, get the error message

if (!dyn.IsOpen())

{ // give the user a message box explaining the error

ErrorMessage(odb.GetServerErrorText());

}


 
Oracle
Copyright © 1998, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback