public Connection getConnection(final String name) throws SQLException, GenericEntityException { return ConnectionFactory.getConnection(name); } };
public Connection getConnection(String helperName) throws SQLException, GenericEntityException { EntityConfigUtil.DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); if (datasourceInfo.inlineJdbcElement != null) { Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.inlineJdbcElement); return otherCon; } else { Debug.logError("Dumb/Empty is the configured transaction manager but no inline-jdbc element was specified in the " + helperName + " datasource. Please check your configuration"); return null; } } }
public void removeDatasource(final String helperName) { ConnectionFactory.removeDatasource(helperName); }
public Connection getConnection() throws SQLException, GenericEntityException { Connection connection = ConnectionFactory.getConnection(helperName); return connection; }
public Connection getConnection(String helperName) throws SQLException, GenericEntityException { EntityConfigUtil.DatasourceInfo datasourceInfo = EntityConfigUtil.getInstance().getDatasourceInfo(helperName); if (datasourceInfo.jndiJdbcElement != null) { Element jndiJdbcElement = datasourceInfo.jndiJdbcElement; String jndiName = jndiJdbcElement.getAttribute("jndi-name"); String jndiServerName = jndiJdbcElement.getAttribute("jndi-server-name"); Connection con = getJndiConnection(jndiName, jndiServerName); if (con != null) return con; } if (datasourceInfo.inlineJdbcElement != null) { Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.inlineJdbcElement); return otherCon; } else { //no real need to print an error here return null; } }
public void removeDatasource(final String helperName) { try { JotmConnectionFactory.removeDatasource(helperName); } catch (Exception ex) { Debug.logError(ex, "Error shutting down the JOTM " + helperName + " datasource. Please check your configuration, class path, etc."); // If no JOTM datasource was found, then the generic connection factory would have been used ConnectionFactory.removeDatasource(helperName); } } }
public Connection getConnection() throws SQLException, GenericEntityException { Connection connection = ConnectionFactory.getConnection(helperName); return connection; }
public Connection getConnection(String helperName) throws SQLException, GenericEntityException { EntityConfigUtil.DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); if (datasourceInfo.jndiJdbcElement != null) { Element jndiJdbcElement = datasourceInfo.jndiJdbcElement; String jndiName = jndiJdbcElement.getAttribute("jndi-name"); String jndiServerName = jndiJdbcElement.getAttribute("jndi-server-name"); Connection con = getJndiConnection(jndiName, jndiServerName); if (con != null) return con; } else { Debug.logError("JNDI loaded is the configured transaction manager but no jndi-jdbc element was specified in the " + helperName + " datasource. Please check your configuration; will try other sources"); } if (datasourceInfo.inlineJdbcElement != null) { Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.inlineJdbcElement); return otherCon; } else { //no real need to print an error here return null; } }
public void removeDatasource(final String helperName) { DatasourceInfo datasourceInfo = EntityConfigUtil.getInstance().getDatasourceInfo(helperName); if (datasourceInfo.getJndiDatasource() == null && datasourceInfo.getJdbcDatasource() != null) { // If a JDBC connection was configured, then there may be one here ConnectionFactory.removeDatasource(helperName); } trackerCache.remove(helperName); } }
private List<Connection> openConnections() { final List<Connection> connectionList = Lists.newArrayListWithCapacity(numberConnections); for (int i = 0; i < numberConnections; i++) { try { final Connection connection = ConnectionFactory.getConnection(ofbizHelperName); connectionList.add(connection); } catch (final SQLException e) { log.error("Could not open connection.", e); } catch (final GenericEntityException e) { log.error("Could not open connection.", e); } } return connectionList; }
public Connection getConnection(String helperName) throws SQLException, GenericEntityException { EntityConfigUtil.DatasourceInfo datasourceInfo = EntityConfigUtil.getInstance().getDatasourceInfo(helperName); if (datasourceInfo.inlineJdbcElement != null) { Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.inlineJdbcElement); return otherCon; } else { Debug.logError("Dumb/Empty is the configured transaction manager but no inline-jdbc element was specified in the " + helperName + " datasource. Please check your configuration"); return null; } } }
public void removeDatasource(final String helperName) { DatasourceInfo datasourceInfo = EntityConfigUtil.getInstance().getDatasourceInfo(helperName); if (datasourceInfo.getJndiDatasource() == null && datasourceInfo.getJdbcDatasource() != null) { // If a JDBC connection was configured, then there may be one here ConnectionFactory.removeDatasource(helperName); } trackerCache.remove(helperName); } }
public Connection getConnection() throws SQLException, DataAccessException { try { return ConnectionFactory.getConnection(getDatabaseConfig().getDatasourceName()); } catch (GenericEntityException e) { throw new DataAccessException(e); } }
public Connection getConnection(String helperName) throws SQLException, GenericEntityException { DatasourceInfo datasourceInfo = EntityConfigUtil.getInstance().getDatasourceInfo(helperName); if (datasourceInfo.getJndiDatasource() != null) { JndiDatasourceInfo jndiDatasource = datasourceInfo.getJndiDatasource(); Connection con = null; try { con = getJndiConnection(helperName, jndiDatasource.getJndiName(), jndiDatasource.getJndiServerName()); } catch (AbstractMethodError err) { log.warn("*********************************************** IMPORTANT ************************************************"); log.warn(" "); log.warn(" We found that you may experience problems with database connectivity because your database driver "); log.warn(" is not fully JDBC 4 compatible. As a workaround of this problem we suggest adding a validation query "); log.warn(" to your database resource configuration in Tomcat's server.xml file:\n"); log.warn(" validationQuery=\"select 1;\" \n"); log.warn(" or to update your database driver to version which fully supports JDBC 4. "); log.warn(" More information about this problem can be found here: https://jira.atlassian.com/browse/JRA-59768 "); log.warn(" "); log.warn("***********************************************************************************************************"); } if (con != null) return con; } if (datasourceInfo.getJdbcDatasource() != null) { Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.getJdbcDatasource()); return otherCon; } else { //no real need to print an error here return null; } }
private int findConstraintNameClipLengthFromJDBCConnection() { final Connection connection; try { connection = ConnectionFactory.getConnection(name); final DatabaseType typeForConnection = DatabaseTypeFactory.getTypeForConnection(connection); if (typeForConnection == null) { Debug.logError("Could not determine database type from "); } return typeForConnection.getConstraintNameClipLength(); } catch (Exception e) { String error = "Could not get connection to database to determine database clip length"; Debug.logError(e, error); return DEFAULT_CONSTRAINT_NAME_CLIP_LENGTH; } } }
public Connection getConnection(String helperName) throws SQLException, GenericEntityException { final DatasourceInfo datasourceInfo = EntityConfigUtil.getInstance().getDatasourceInfo(helperName); if (datasourceInfo.getJdbcDatasource() == null) { Debug.logError("Dumb/Empty is the configured transaction manager but no inline-jdbc element was specified in the " + helperName + " datasource. Please check your configuration"); return null; } return ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.getJdbcDatasource()); }
Connection connection = ConnectionFactory.getConnection(helperName); if (transactionIsolationLevel >= 0) connection.setTransactionIsolation(transactionIsolationLevel);
public Connection getConnection(String helperName) throws SQLException, GenericEntityException { EntityConfigUtil.DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); if (datasourceInfo.inlineJdbcElement != null) { // Use JOTM (enhydra-jdbc.jar) connection pooling try { Connection con = JotmConnectionFactory.getConnection(helperName, datasourceInfo.inlineJdbcElement); if (con != null) return con; } catch (Exception ex) { Debug.logError(ex, "JOTM is the configured transaction manager but there was an error getting a database Connection through JOTM for the " + helperName + " datasource. Please check your configuration, class path, etc."); } Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.inlineJdbcElement); return otherCon; } else { Debug.logError("JOTM is the configured transaction manager but no inline-jdbc element was specified in the " + helperName + " datasource. Please check your configuration"); return null; } } }
/** * Provides a database type. * * @return the database type. */ public DatabaseType getDatabaseTypeFromJDBCConnection() { if (databaseType == null) { Connection connection = null; try { connection = ConnectionFactory.getConnection(name); databaseType = getDatabaseTypeFromJDBCConnection(connection); } catch (Exception e) { String error = "Could not determine database type."; Debug.logError(e, error); throw new GeneralRuntimeException(error, e); } finally { silentlyClose(connection); } } return databaseType; }
Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.inlineJdbcElement); return otherCon; } else if (datasourceInfo.tyrexDataSourceElement != null) { Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.inlineJdbcElement); return otherCon; } else {