use of org.dbflute.exception.DfJDBCException in project dbflute-core by dbflute.
the class DfDataSourceHandler method commit.
public void commit() throws SQLException {
Connection conn = null;
try {
conn = getCachedConnection();
if (conn == null) {
// if no cache, do nothing
return;
}
if (!conn.getAutoCommit()) {
_log.info("...commit()");
conn.commit();
}
} catch (SQLException e) {
String msg = "Failed to commit the conection: conn=" + conn;
throw new DfJDBCException(msg, e);
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException ignored) {
}
}
}
}
use of org.dbflute.exception.DfJDBCException in project dbflute-core by dbflute.
the class DfProcedureExtractor method throwProcedureListGettingFailureException.
protected void throwProcedureListGettingFailureException(UnifiedSchema unifiedSchema, String procedureName, Exception e) throws SQLException {
final boolean forSqlEx = e instanceof SQLException;
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("Failed to get a list of procedures.");
br.addItem("Unified Schema");
br.addElement(unifiedSchema);
br.addItem("Current Procedure");
br.addElement(procedureName);
br.addItem(forSqlEx ? "Caused SQLException" : "Unexpected Exception");
br.addElement(e.getClass().getName());
br.addElement(e.getMessage());
final String msg = br.buildExceptionMessage();
if (forSqlEx) {
throw new DfJDBCException(msg, (SQLException) e);
} else {
throw new DfProcedureListGettingFailureException(msg, e);
}
}
Aggregations