|
SilverStream Application Server 3.5 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.lang.Throwable
|
+--java.lang.Exception
|
+--com.sssw.rt.util.AgoException
|
+--com.sssw.rt.util.AgoApiException
|
+--com.sssw.rt.util.AgoSystemException
|
+--com.sssw.rt.util.AgoUnrecoverableSystemException
|
+--com.sssw.rt.util.AgoSystemDatabaseException
The subclass of AgoUnrecoverableSystemException that indicates that the system exception occurred during a database operation, and conveys additional database status information. Most often, this additional status information is obtained from a JDBC SQL Exception.
| Constructor Summary | |
AgoSystemDatabaseException(String message)
AgoSystemDatabaseException constructor. |
|
AgoSystemDatabaseException(Throwable parent,
String message)
AgoSystemDatabaseException constructor. |
|
| Method Summary | |
char |
getCommandCode()
Return the command code that describes the database command that was being performed when the exception occured. |
int |
getErrorCode()
Get the database error code. |
String |
getFieldName()
Return the name of the field that was being updated when the database exception occurred, if known. |
String |
getRowKey()
Get the "row key" which identifies the data row on which an exception occurred. |
void |
setCommandCode(char commandCode)
setCommandCode. |
void |
setErrorCode(int errorCode)
Save the database error code |
void |
setFieldName(String f)
Set the name of the field that was being updated when the database exception occurred, if known. |
void |
setRowKey(String rowKey)
Set the "row key" which identifies the data row on which an exception occurred. |
| Methods inherited from class com.sssw.rt.util.AgoException |
copyTo,
getExceptionHTML,
getExceptionMessage,
getExceptionMessage,
getHTML,
getMessage,
getMessage,
getParentException,
printStackTrace,
printStackTrace,
printStackTrace,
setHTML |
| Methods inherited from class java.lang.Throwable |
fillInStackTrace,
getLocalizedMessage,
printStackTrace,
printStackTrace,
printStackTrace,
toString |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Methods implemented from interface com.sssw.rt.util.AgiParentedException |
getExceptionParent |
| Constructor Detail |
public AgoSystemDatabaseException(String message)
public AgoSystemDatabaseException(Throwable parent,
String message)
| Method Detail |
public void setErrorCode(int errorCode)
errorCode - the database error code, typically from a SQLExceptionThis example might occur in a data source object.
try {
ResultSet rs = statement.executeUpdate("insert into atable set (id) values (5)");
} catch (SQLException sqlX) {
AgoSystemDatabaseException ex = new AgoSystemDatabaseException(sqlX, "Unable to perform insert");
ex.setErrorCode(sqlX.getErrorCode());
throw ex;
}
AgoSystemDatabaseException.getErrorCode()public int getErrorCode()
try {
agData.query("ID > 5", "ID asc");
} catch (AgSystemDatabaseException ex) {
System.out.println("A database exception occurred on the query: " +
ex.getMessage() +
"\nThe error code was " +
ex.getCommandCode());
}
AgoSystemDatabaseException.setErrorCode(int)public void setRowKey(String rowKey)
rowKey - the row identifier for this data row, typically obtained
from the data row's getRowKey() operation
AgiDataRow nextRow;
int colNo = 1;
try {
statement.setString(colNo+1, nextRow.getData(colNo));
} catch (SQLException sqlX) {
AgoSystemDatabaseException ex = new AgoSystemDatabaseException(sqlX, "Exception binding column value");
ex.setRowKey(nextRow.getRowKey());
throw ex;
}
AgoSystemDatabaseException.getRowKey()public String getRowKey()
try {
agData.updateRows();
} catch (AgSystemDatabaseException ex) {
System.out.println("A database exception occurred while updating row " +
ex.getRowKey() +
"\nThe exception was " +
ex.getMessage());
}
AgoSystemDatabaseException.setRowKey(String)public void setCommandCode(char commandCode)
commandCode - the command code describing the database command
being executed, from CommandCodes.This example might occur in a data source object.
try {
ResultSet rs = statement.executeUpdate("insert into atable set (id) values (5)");
} catch (SQLException sqlX) {
AgoSystemDatabaseException ex = new AgoSystemDatabaseException(sqlX, "Unable to perform database update");
ex.setCommandCode(CommandCodes.CCINSERT);
throw ex;
}
AgoSystemDatabaseException.getCommandCode(),
CommandCodespublic char getCommandCode()
CommandCodes.
try {
agData.updateRows();
} catch (AgSystemDatabaseException ex) {
System.out.println("A database exception during a " +
ex.getCommandCode() +
"operation.\nThe exception was: " +
ex.getMessage());
}
AgoSystemDatabaseException.setCommandCode(char),
CommandCodespublic String getFieldName()
try {
agData.updateRows();
} catch (AgSystemDatabaseException ex) {
System.out.println("A database exception occurred during update: " +
ex.getMessage());
String field = ex.getFieldName();
if (!field.equals("-1")) {
System.out.println("The error occurred on column " +
agData.getPropertyName(Integer.parseInt(field)));
}
}
AgoSystemDatabaseException.setFieldName(String)public void setFieldName(String f)
f - the field name, should be "-1" if unknown
int colNo = 1;
try {
statement.setString(colNo+1, "A fine kettle of fish");
} catch (SQLException sqlX) {
AgoSystemDatabaseException ex = new AgoSystemDatabaseException(sqlX, "Exception binding column value");
ex.setFieldName(Integer.toString(colNo));
throw ex;
}
AgoSystemDatabaseException.getFieldName()
|
SilverStream Application Server 3.5 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||