Using Errors and Warnings
By default, TimesTen messages and diagnostic information are stored in:
-
A user error log that contains error message information. Generally, these messages contain information on actions you may need to take. The default file is
timesten_home/diag/tterrors.log. For more information on modifying the location of the user error log, see Error, Warning, and Informational Messages in the Oracle TimesTen In-Memory Database Operations Guide. -
A daemon log containing everything in the user error log plus information that may be useful for TimesTen Customer Support. The default file is
timesten_home/diag/ttmesg.log. For more information on modifying the location of the support log, see Error, Warning, and Informational Messages in the Oracle TimesTen In-Memory Database Operations Guide. -
An invalidation file containing diagnostic information when TimesTen invalidates a database. This file provides useful troubleshooting information for TimesTen Customer Support. The invalidation file is created and named based on the value specified by the
DataStoreconnection attribute. This connection attribute is not a file name. For example on Linux platforms, if theDataStoreconnection attribute is/home/ttuser/AdminData, the actual invalidation file name has a suffix,.inval,/home/ttuser/AdminData.inval. For more information on theDataStoreconnection attribute, see DataStore in the Oracle TimesTen In-Memory Database Reference.
Note:
Not all error numbers are currently in use.
Retrieving Errors and Warnings
This section describes how to retrieve native error codes and messages in JDBC and ODBC.
Retrieve a Native Error Code and Message in JDBC
In JDBC, the native error code and message can be retrieved as shown in this example:
private static void printSQLExceptions(SQLException e)
{
while (e != null) {
System.out.println("SQLState: " +
e.getSQLState());
System.out.println("Message : " +
e.getMessage());
System.out.println("Vendor : " +
e.getErrorCode());
e.printStackTrace();
e = e.getNextException();
System.out.println("");
}
e.printStackTrace();
}
. . .
try {
// JDBC method calls here
}
catch (SQLException ex) {
ex.printSQLExceptions();
}
It is possible for a single JDBC operation to generate multiple errors. These errors
can be retrieved using multiple calls to the JDBC method
SQLException.
Retrieve a Native Error Code and Message in ODBC
In ODBC the native error code and message can be retrieved with the SQLError function, as shown in the following example:
#define MSG_LNG 512
SQLCHAR szSqlState[MSG_LNG]; /* SQL state string */
SQLINTEGER pfNativeError; /* Native error code */
SQLCHAR szErrorMsg[MSG_LNG];
/* Error msg text buffer pointer */
SQLSMALLINT pcbErrorMsg;
/* Error msg text Available bytes */
SQLRETURN ret = SQL_SUCCESS;
while ( ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO ) {
ret = SQLError(henv, hdbc, hstmt, szSqlState, &pfNativeError,
szErrorMsg, MSG_LNG, &pcbErrorMsg);
switch (ret) {
case SQL_SUCCESS:
fprintf(stderr, "*** %s\n*** ODBC Err = %s, ",
"TimesTen Err = %ld\n",
szErrorMsg, szSqlState, pfNativeError);
break;
case SQL_SUCCESS_WITH_INFO:
fprintf(stderr, "*** Call to SQLError failed with return ",
"code of SQL_SUCCESS_WITH_INFO.\n ",
"*** Need to increase size of ",
"message buffer.\n");
break;
case SQL_INVALID_HANDLE:
fprintf(stderr, "*** Call to SQLError failed with ",
"return code of SQL_INVALID_HANDLE.\n");
break;
case SQL_ERROR:
fprintf(stderr, "*** Call to SQLError failed with ",
"return code of SQL_ERROR.\n");
break;
case SQL_NO_DATA_FOUND:
break;
}
}It is possible for a single ODBC operation to generate multiple errors. These errors
can be retrieved using multiple calls to the ODBC function SQLError.
Error Reporting in OCI, Pro*C and PL/SQL Applications
TimesTen OCI and Pro*C applications, and those that use PL/SQL, report errors using Oracle database error codes instead of TimesTen error codes. The error messages that accompany the error codes may come from the TimesTen error catalog or the Oracle database error catalog.
Base Level Diagnostics
TimesTen optionally generates warnings in the range of 20000 and 29999 that describe
basic diagnostic information for a particular connection. The generation of these
messages is determined by the general connection attribute Diagnostics.
For details, see Diagnostics in Oracle TimesTen In-Memory Database
Reference.
There is no means to control the generation of any other warnings or errors listed in this chapter.