Package org.infinispan.persistence.jdbc.configuration

Examples of org.infinispan.persistence.jdbc.configuration.PooledConnectionFactoryConfiguration


               factoryConfiguration;
         connection = DriverManager.getConnection(simpleConfiguration.connectionUrl(),
               simpleConfiguration.username(), simpleConfiguration.password());

      } else if (factoryConfiguration instanceof PooledConnectionFactoryConfiguration) {
         PooledConnectionFactoryConfiguration pooledConfiguration = (PooledConnectionFactoryConfiguration)
               factoryConfiguration;
         connection = DriverManager.getConnection(pooledConfiguration.connectionUrl(),
               pooledConfiguration.username(), pooledConfiguration.password());
      }
      tableManipulation.setCacheName("aName");
   }
View Full Code Here


   private ComboPooledDataSource pooledDataSource;

   @Override
   public void start(ConnectionFactoryConfiguration config, ClassLoader classLoader) throws PersistenceException {
      logFileOverride(classLoader);
      PooledConnectionFactoryConfiguration pooledConfiguration;
      if (config instanceof PooledConnectionFactoryConfiguration) {
         pooledConfiguration = (PooledConnectionFactoryConfiguration) config;
      }
      else {
         throw new PersistenceException("ConnectionFactoryConfiguration passed in must be an instance of " +
               "PooledConnectionFactoryConfiguration");
      }
      pooledDataSource = new ComboPooledDataSource();
      pooledDataSource.setProperties(new Properties());
      try {
         /* Since c3p0 does not throw an exception when it fails to load a driver we attempt to do so here
          * Also, c3p0 does not allow specifying a custom classloader, so use c3p0's
          */
         Class.forName(pooledConfiguration.driverClass(), true, ComboPooledDataSource.class.getClassLoader());
         pooledDataSource.setDriverClass(pooledConfiguration.driverClass()); //loads the jdbc driver
      } catch (Exception e) {
         log.errorInstantiatingJdbcDriver(pooledConfiguration.driverClass(), e);
         throw new PersistenceException(String.format(
               "Error while instatianting JDBC driver: '%s'", pooledConfiguration.driverClass()), e);
      }
      pooledDataSource.setJdbcUrl(pooledConfiguration.connectionUrl());
      pooledDataSource.setUser(pooledConfiguration.username());
      pooledDataSource.setPassword(pooledConfiguration.password());
      if (log.isTraceEnabled()) {
         log.tracef("Started connection factory with config: %s", config);
      }
   }
View Full Code Here

   private ComboPooledDataSource pooledDataSource;

   @Override
   public void start(ConnectionFactoryConfiguration config, ClassLoader classLoader) throws CacheLoaderException {
      logFileOverride(classLoader);
      PooledConnectionFactoryConfiguration pooledConfiguration;
      if (config instanceof PooledConnectionFactoryConfiguration) {
         pooledConfiguration = (PooledConnectionFactoryConfiguration) config;
      }
      else {
         throw new CacheLoaderException("ConnectionFactoryConfiguration passed in must be an instance of " +
               "PooledConnectionFactoryConfiguration");
      }
      pooledDataSource = new ComboPooledDataSource();
      pooledDataSource.setProperties(new Properties());
      try {
         /* Since c3p0 does not throw an exception when it fails to load a driver we attempt to do so here
          * Also, c3p0 does not allow specifying a custom classloader, so use c3p0's
          */
         Class.forName(pooledConfiguration.driverClass(), true, ComboPooledDataSource.class.getClassLoader());
         pooledDataSource.setDriverClass(pooledConfiguration.driverClass()); //loads the jdbc driver
      } catch (Exception e) {
         log.errorInstantiatingJdbcDriver(pooledConfiguration.driverClass(), e);
         throw new CacheLoaderException(String.format(
               "Error while instatianting JDBC driver: '%s'", pooledConfiguration.driverClass()), e);
      }
      pooledDataSource.setJdbcUrl(pooledConfiguration.connectionUrl());
      pooledDataSource.setUser(pooledConfiguration.username());
      pooledDataSource.setPassword(pooledConfiguration.password());
      if (log.isTraceEnabled()) {
         log.tracef("Started connection factory with config: %s", config);
      }
   }
View Full Code Here

               factoryConfiguration;
         connection = DriverManager.getConnection(simpleConfiguration.connectionUrl(),
               simpleConfiguration.username(), simpleConfiguration.password());

      } else if (factoryConfiguration instanceof PooledConnectionFactoryConfiguration) {
         PooledConnectionFactoryConfiguration pooledConfiguration = (PooledConnectionFactoryConfiguration)
               factoryConfiguration;
         connection = DriverManager.getConnection(pooledConfiguration.connectionUrl(),
               pooledConfiguration.username(), pooledConfiguration.password());
      }
      tableManipulation.setCacheName("aName");
   }
View Full Code Here

   private ComboPooledDataSource pooledDataSource;

   @Override
   public void start(ConnectionFactoryConfiguration config, ClassLoader classLoader) throws PersistenceException {
      logFileOverride(classLoader);
      PooledConnectionFactoryConfiguration pooledConfiguration;
      if (config instanceof PooledConnectionFactoryConfiguration) {
         pooledConfiguration = (PooledConnectionFactoryConfiguration) config;
      }
      else {
         throw new PersistenceException("ConnectionFactoryConfiguration passed in must be an instance of " +
               "PooledConnectionFactoryConfiguration");
      }
      pooledDataSource = new ComboPooledDataSource();
      pooledDataSource.setProperties(new Properties());
      try {
         /* Since c3p0 does not throw an exception when it fails to load a driver we attempt to do so here
          * Also, c3p0 does not allow specifying a custom classloader, so use c3p0's
          */
         Class.forName(pooledConfiguration.driverClass(), true, ComboPooledDataSource.class.getClassLoader());
         pooledDataSource.setDriverClass(pooledConfiguration.driverClass()); //loads the jdbc driver
      } catch (Exception e) {
         log.errorInstantiatingJdbcDriver(pooledConfiguration.driverClass(), e);
         throw new PersistenceException(String.format(
               "Error while instatianting JDBC driver: '%s'", pooledConfiguration.driverClass()), e);
      }
      pooledDataSource.setJdbcUrl(pooledConfiguration.connectionUrl());
      pooledDataSource.setUser(pooledConfiguration.username());
      pooledDataSource.setPassword(pooledConfiguration.password());
      if (log.isTraceEnabled()) {
         log.tracef("Started connection factory with config: %s", config);
      }
   }
View Full Code Here

TOP

Related Classes of org.infinispan.persistence.jdbc.configuration.PooledConnectionFactoryConfiguration

Copyright © 2018 www.massapicom. 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.