public class OlapException extends SQLException
An exception describing an error accessing an OLAP database.
Since olap4j extends JDBC, it is natural that OlapException
should extend JDBC's SQLException
. The implementation by an olap4j
driver of a JDBC method which is declared to throw a SQLException may, if the
driver chooses, throw instead an OlapException.
OlapException provides some additional information to help an OLAP client identify the location of the error. This information is
Modifier and Type | Class and Description |
---|---|
static class |
OlapException.Region
Description of the position of a syntax or validation error in the source
MDX string.
|
Constructor and Description |
---|
OlapException()
Constructs an
OlapException object;
the reason field defaults to null,
the sqlState field defaults to null , and
the vendorCode field defaults to 0. |
OlapException(String reason)
Constructs an
OlapException object with a reason;
the sqlState field defaults to null , and
the vendorCode field defaults to 0. |
OlapException(String reason,
String sqlState)
Constructs an
OlapException object with the given reason and
SQLState; the vendorCode field defaults to 0. |
OlapException(String reason,
String sqlState,
int vendorCode)
Constructs an
OlapException object with a given
reason , SQLState and
vendorCode . |
OlapException(String reason,
String sqlState,
int vendorCode,
Throwable cause)
Constructs an
OlapException object with a given
reason , SQLState , vendorCode
and cause . |
OlapException(String reason,
String sqlState,
Throwable cause)
Constructs an
OlapException object with a given
reason , SQLState and cause . |
OlapException(String reason,
Throwable cause)
Constructs an
OlapException object with a given
reason and cause . |
OlapException(Throwable cause)
Constructs an
OlapException object with a given
cause . |
Modifier and Type | Method and Description |
---|---|
Object |
getContext()
Returns the context where the exception occurred.
|
OlapException.Region |
getRegion()
Returns the textual region where the exception occurred, or null if no
region can be identified.
|
void |
setContext(Object context)
Sets the context where the exception occurred.
|
void |
setRegion(OlapException.Region region)
Sets the textual region where the exception occurred.
|
getErrorCode, getNextException, getSQLState, iterator, setNextException
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public OlapException(String reason, String sqlState, int vendorCode)
OlapException
object with a given
reason
, SQLState
and
vendorCode
.reason
- a description of the exceptionsqlState
- an XOPEN or SQL 99 code identifying the exceptionvendorCode
- a database vendor-specific exception codepublic OlapException(String reason, String sqlState)
OlapException
object with the given reason and
SQLState; the vendorCode
field defaults to 0.reason
- a description of the exceptionsqlState
- an XOPEN or SQL 99 code identifying the exceptionpublic OlapException(String reason)
OlapException
object with a reason;
the sqlState
field defaults to null
, and
the vendorCode
field defaults to 0.reason
- a description of the exceptionpublic OlapException()
OlapException
object;
the reason
field defaults to null,
the sqlState
field defaults to null
, and
the vendorCode
field defaults to 0.public OlapException(Throwable cause)
OlapException
object with a given
cause
.
The SQLState
is initialized
to null
and the vendor code is initialized to 0.
The reason
is initialized to null
if
cause==null
or to cause.toString()
if
cause!=null
.
cause
- the underlying reason for this OlapException
(which is saved for later retrieval by the getCause()
method); may be null indicating the cause is non-existent or unknown.public OlapException(String reason, Throwable cause)
OlapException
object with a given
reason
and cause
.reason
- the detail message (which is saved for later retrieval
by the Throwable.getMessage()
method).cause
- the cause (which is saved for later retrieval by the
Throwable.getCause()
method). (A null value is
permitted, and indicates that the cause is nonexistent or
unknown.)public OlapException(String reason, String sqlState, Throwable cause)
OlapException
object with a given
reason
, SQLState
and cause
.
The vendor code is initialized to 0.reason
- a description of the exception.sqlState
- an XOPEN or SQL:2003 code identifying the exceptioncause
- the underlying reason for this OlapException
(which is saved for later retrieval by the
getCause()
method); may be null indicating
the cause is non-existent or unknown.public OlapException(String reason, String sqlState, int vendorCode, Throwable cause)
OlapException
object with a given
reason
, SQLState
, vendorCode
and cause
.reason
- a description of the exceptionsqlState
- an XOPEN or SQL:2003 code identifying the exceptionvendorCode
- a database vendor-specific exception codecause
- the underlying reason for this OlapException
(which is saved for later retrieval by the getCause()
method);
may be null indicating the cause is non-existent or unknown.public void setRegion(OlapException.Region region)
region
- Textual regionpublic OlapException.Region getRegion()
public void setContext(Object context)
context
- Context where the exception occurredIllegalArgumentException
- If context is not a Cell
or a Position
public Object getContext()