Examples of ConnectionProvider


Examples of org.hibernate.service.jdbc.connections.spi.ConnectionProvider

      // nothing to do, but given the separate hierarchies have to handle this here.
    }

    final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );

    ConnectionProvider connectionProvider = null;
    String providerClassName = getConfiguredConnectionProviderName( configurationValues );
    if ( providerClassName != null ) {
      connectionProvider = instantiateExplicitConnectionProvider( providerClassName, classLoaderService );
    }
    else if ( configurationValues.get( Environment.DATASOURCE ) != null ) {
      connectionProvider = new DatasourceConnectionProviderImpl();
    }

    if ( connectionProvider == null ) {
      if ( c3p0ConfigDefined( configurationValues ) && c3p0ProviderPresent( classLoaderService ) ) {
        connectionProvider = instantiateExplicitConnectionProvider( C3P0_PROVIDER_CLASS_NAME,
            classLoaderService
        );
      }
    }

    if ( connectionProvider == null ) {
      if ( proxoolConfigDefined( configurationValues ) && proxoolProviderPresent( classLoaderService ) ) {
        connectionProvider = instantiateExplicitConnectionProvider( PROXOOL_PROVIDER_CLASS_NAME,
            classLoaderService
        );
      }
    }

    if ( connectionProvider == null ) {
      if ( configurationValues.get( Environment.URL ) != null ) {
        connectionProvider = new DriverManagerConnectionProviderImpl();
      }
    }

    if ( connectionProvider == null ) {
            LOG.noAppropriateConnectionProvider();
      connectionProvider = new UserSuppliedConnectionProviderImpl();
    }


    final Map injectionData = (Map) configurationValues.get( INJECTION_DATA );
    if ( injectionData != null && injectionData.size() > 0 ) {
      final ConnectionProvider theConnectionProvider = connectionProvider;
      new BeanInfoHelper( connectionProvider.getClass() ).applyToBeanInfo(
          connectionProvider,
          new BeanInfoHelper.BeanInfoDelegate() {
            public void processBeanInfo(BeanInfo beanInfo) throws Exception {
              PropertyDescriptor[] descritors = beanInfo.getPropertyDescriptors();
View Full Code Here

Examples of org.hibernate.service.jdbc.connections.spi.ConnectionProvider

        Connection connection = null;
        try {
            fileWriter = new BufferedWriter(new FileWriter(getExistingDataFile()), IO_BUFFER_SIZE);
            Session session = (Session) entityManager.getDelegate();
            SessionFactoryImplementor sfi = (SessionFactoryImplementor) session.getSessionFactory();
            ConnectionProvider cp = sfi.getConnectionProvider();
            connection = cp.getConnection();
            CopyManager copyManager = new CopyManager((BaseConnection) connection);

            if (maxResults > 0) {
                copyManager.copyOut("COPY (" + selectNativeQuery + " LIMIT " + maxResults
                    + ") TO STDOUT WITH DELIMITER '" + DELIMITER + "'", fileWriter);
View Full Code Here

Examples of org.hibernate.service.jdbc.connections.spi.ConnectionProvider

        ResultSet resultSet = null;
        try {
            fileWriter = new BufferedWriter(new FileWriter(getExistingDataFile()), IO_BUFFER_SIZE);
            Session session = (Session) this.entityManager.getDelegate();
            SessionFactoryImplementor sfi = (SessionFactoryImplementor) session.getSessionFactory();
            ConnectionProvider cp = sfi.getConnectionProvider();
            connection = cp.getConnection();
            statement = connection.prepareStatement(this.selectNativeQuery);
            resultSet = statement.executeQuery();
            int columnCount = resultSet.getMetaData().getColumnCount();
            while (resultSet.next()) {
                for (int i = 1; i < columnCount + 1; i++) {
View Full Code Here

Examples of org.hibernate.service.jdbc.connections.spi.ConnectionProvider

   * @return the DataSource, or <code>null</code> if none found
   * @see org.hibernate.engine.spi.SessionFactoryImplementor#getConnectionProvider
   */
  public static DataSource getDataSource(SessionFactory sessionFactory) {
    if (sessionFactory instanceof SessionFactoryImplementor) {
      ConnectionProvider cp = ((SessionFactoryImplementor) sessionFactory).getConnectionProvider();
      return cp.unwrap(DataSource.class);
    }
    return null;
  }
View Full Code Here

Examples of org.jfree.report.modules.data.sql.ConnectionProvider

   *
   * @throws SAXException       if there is a parsing error.
   */
  protected void doneParsing() throws SAXException
  {
    ConnectionProvider provider = null;
    if (connectionProviderReadHandler != null)
    {
      provider = connectionProviderReadHandler.getProvider();
    }
    if (provider == null)
View Full Code Here

Examples of org.jooq.ConnectionProvider

                .fetch();
    }

    @Override
    protected void loadForeignKeys(DefaultRelations relations) throws SQLException {
        ConnectionProvider provider = create().configuration().connectionProvider();
        Connection connection = null;

        try {
            connection = provider.acquire();
            DatabaseMetaData meta = connection.getMetaData();

            for (String table : create()
                    .selectDistinct(DB_INDEX.CLASS_NAME)
                    .from(DB_INDEX)
                    .where(DB_INDEX.IS_FOREIGN_KEY.isTrue())
                    .fetch(DB_INDEX.CLASS_NAME)) {

                for (Record record : create().fetch(meta.getImportedKeys(null, null, table))) {
                    String foreignKeyName =
                        record.getValue("FKTABLE_NAME", String.class) +
                        "__" +
                        record.getValue("FK_NAME", String.class);
                    String foreignKeyTableName = record.getValue("FKTABLE_NAME", String.class);
                    String foreignKeyColumnName = record.getValue("FKCOLUMN_NAME", String.class);
                    String uniqueKeyName =
                        record.getValue("PKTABLE_NAME", String.class) +
                        "__" +
                        record.getValue("PK_NAME", String.class);

                    TableDefinition referencingTable = getTable(getSchemata().get(0), foreignKeyTableName);
                    if (referencingTable != null) {
                        ColumnDefinition column = referencingTable.getColumn(foreignKeyColumnName);
                        relations.addForeignKey(foreignKeyName, uniqueKeyName, column, getSchemata().get(0));
                    }
                }
            }
        }
        finally {
            if (connection != null) {
                provider.release(connection);
            }
        }
    }
View Full Code Here

Examples of org.jooq.ConnectionProvider

    @Override
    public final ConnectionProvider connectionProvider() {

        // [#3229] If we're currently in a transaction, return that transaction's
        // local DefaultConnectionProvider, not the one from this configuration
        ConnectionProvider transactional = (ConnectionProvider) data(DATA_DEFAULT_TRANSACTION_PROVIDER_CONNECTION);
        return transactional == null ? connectionProvider : transactional;
    }
View Full Code Here

Examples of org.jooq.ConnectionProvider

        // All jOOQ internals are expected to get a connection through this
        // single method. It can thus be guaranteed, that every connection is
        // wrapped by a ConnectionProxy, transparently, in order to implement
        // Settings.getStatementType() correctly.

        ConnectionProvider provider = connectionProvider != null ? connectionProvider : configuration.connectionProvider();
        if (connection == null && provider != null) {
            connection(provider, provider.acquire());
        }

        return connection;
    }
View Full Code Here

Examples of org.jooq.ConnectionProvider

        this.configuration = configuration;
    }

    private final DatabaseMetaData meta() {
        if (meta == null) {
            ConnectionProvider provider = configuration.connectionProvider();
            Connection connection = null;

            try {
                connection = provider.acquire();
                meta = connection.getMetaData();
            }
            catch (SQLException e) {
                throw new DataAccessException("Error while accessing DatabaseMetaData", e);
            }
            finally {
                if (connection != null) {
                    provider.release(connection);
                }
            }
        }

        return meta;
View Full Code Here

Examples of org.mc4j.ems.connection.support.ConnectionProvider

            // TODO GH: Add intelligent classloader layer here that can either work
            // directly against current classloader or build a non-delegating child
            // to override with connection specific classes
            Class clazz = Class.forName(className, false, loader);

            ConnectionProvider connectionProvider = (ConnectionProvider) clazz.newInstance();

            connectionProvider.initialize(connectionSettings);
            return connectionProvider;

        } catch (IllegalAccessException e) {
            throw new ConnectionException("Could not access ConnectionClass " + className, e);
        } catch (InstantiationException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.