use of org.apache.ofbiz.entity.config.model.JndiJdbc in project ofbiz-framework by apache.
the class JNDITransactionFactory method getConnection.
public Connection getConnection(GenericHelperInfo helperInfo) throws SQLException, GenericEntityException {
Datasource datasourceInfo = EntityConfig.getDatasource(helperInfo.getHelperBaseName());
if (datasourceInfo.getJndiJdbc() != null) {
JndiJdbc jndiJdbcElement = datasourceInfo.getJndiJdbc();
String jndiName = jndiJdbcElement.getJndiName();
String jndiServerName = jndiJdbcElement.getJndiServerName();
Connection con = getJndiConnection(jndiName, jndiServerName);
if (con != null) {
return TransactionUtil.getCursorConnection(helperInfo, con);
}
} else {
}
if (datasourceInfo.getInlineJdbc() != null) {
Connection otherCon = ConnectionFactoryLoader.getInstance().getConnection(helperInfo, datasourceInfo.getInlineJdbc());
return TransactionUtil.getCursorConnection(helperInfo, otherCon);
}
// no real need to print an error here
return null;
}
Aggregations