use of lucee.runtime.exp.DatabaseException in project Lucee by lucee.
the class DatasourceResourceProvider method getDatasourceConnection.
private DatasourceConnection getDatasourceConnection(ConnectionData data, boolean autoCommit) throws PageException {
DatasourceConnection dc = getManager().getConnection(ThreadLocalPageContext.get(), data.getDatasourceName(), data.getUsername(), data.getPassword());
try {
dc.getConnection().setAutoCommit(autoCommit);
dc.getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
} catch (SQLException e) {
throw new DatabaseException(e, dc);
}
return dc;
}
use of lucee.runtime.exp.DatabaseException in project Lucee by lucee.
the class DatasourceResourceProvider method _getAttr.
private Attr _getAttr(ConnectionData data, int fullPathHash, String path, String name) throws PageException {
if (!StringUtil.isEmpty(data.getDatasourceName())) {
DatasourceConnection dc = null;
try {
dc = getDatasourceConnection(data);
Attr attr = getCore(data).getAttr(dc, data.getPrefix(), fullPathHash, path, name);
if (attr != null)
return putToCache(data, path, name, attr);
} catch (SQLException e) {
throw new DatabaseException(e, dc);
} finally {
getManager().releaseConnection(ThreadLocalPageContext.get(), dc);
}
}
return putToCache(data, path, name, Attr.notExists(name, path));
}
Aggregations