Package com.mchange.v2.c3p0

Examples of com.mchange.v2.c3p0.ComboPooledDataSource


    {
  try
      {
        cpds.setIdentityToken("scoop"); //simulate a never-before-seen data source, so it's a new registration on deserialization
    Reference ref = cpds.getReference();
    ComboPooledDataSource unpickled = (ComboPooledDataSource) ReferenceableUtils.referenceToObject( ref, null, null, null );
    assertTrue( "Marshalled and unmarshalled DataSources should have the same properties!",
          BeansUtils.equalsByAccessibleProperties( cpds, unpickled, EXCLUDE_PROPS ) );
      }
  catch (Exception e)
      {
View Full Code Here


      logger.info("\n\t\tRunning Test: " + testName);
    }

    // assertTrue(false);
    Object obj = applicationContext.getBean("dataSource");
    ComboPooledDataSource ds = (ComboPooledDataSource) obj;

    if (logger.isInfoEnabled()) {
      logger.info("num of connections=" + ds.getNumConnectionsDefaultUser());
      logger.info("num of busy connections=" + ds.getNumBusyConnections());
      logger.info("acquire increment =" + ds.getAcquireIncrement());
      logger.info("driver class=" + ds.getDriverClass());
      logger.info("initial pool size=" + ds.getInitialPoolSize());
      logger.info("max pool size=" + ds.getMaxPoolSize());
      logger.info("min pool size=" + ds.getMinPoolSize());
      logger.info("thread pool size=" + ds.getThreadPoolSize());
      logger.info("max statemetn size=" + ds.getMaxStatements());
      logger.info("num helper threads=" + ds.getNumHelperThreads());

      logger.info(testName + " - end "); //$NON-NLS-1$
    }
  }
View Full Code Here

   private ComboPooledDataSource pooledDataSource;

   @Override
   public void start(ConnectionFactoryConfig config) throws CacheLoaderException {
      logFileOverride();
      pooledDataSource = new ComboPooledDataSource();
      pooledDataSource.setProperties(new Properties());
      try {
         pooledDataSource.setDriverClass(config.getDriverClass()); //loads the jdbc driver
      } catch (PropertyVetoException e) {
         String message = "Error while instatianting JDBC driver: '" + config.getDriverClass();
View Full Code Here

   private ComboPooledDataSource pooledDataSource;

   @Override
   public void start(ConnectionFactoryConfig config) throws CacheLoaderException {
      logFileOverride();
      pooledDataSource = new ComboPooledDataSource();
      pooledDataSource.setProperties(new Properties());
      try {
         pooledDataSource.setDriverClass(config.getDriverClass()); //loads the jdbc driver
      } catch (PropertyVetoException e) {
         log.errorInstantiatingJdbcDriver(config.getDriverClass(), e);
View Full Code Here

    Module module = WayRelational.standardModuleUsing(credential);
    Injector injector = com.google.inject.Guice.createInjector(module);

    ConnectionProvider provider = injector.getInstance(ConnectionProvider.class);
    ConnectionProviderC3p0 c3p0 = (ConnectionProviderC3p0) provider;
    ComboPooledDataSource ds = c3p0.getDataSource();
    assertThat(ds.getMaxPoolSize(), equalTo(50));

    Options options = injector.getInstance(Options.class);
    assertThat(options.getBatchSize(), equalTo(2000));
    assertThat(options.getIterationLength(), equalTo(2000));
  }
View Full Code Here

    Injector injector = com.google.inject.Guice.createInjector(module);

    ConnectionProvider provider = injector.getInstance(ConnectionProvider.class);
    ConnectionProviderC3p0 c3p0 = (ConnectionProviderC3p0) provider;
    ComboPooledDataSource ds = c3p0.getDataSource();
    assertThat(ds.getMaxPoolSize(), equalTo(50));

    Options options = injector.getInstance(Options.class);
    assertThat(options.getBatchSize(), equalTo(10));
    assertThat(options.getIterationLength(), equalTo(20));
  }
View Full Code Here

      }
      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
          */
 
View Full Code Here

      }
      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
          */
 
View Full Code Here

    try {
      InitialContext aContext = new InitialContext();
      setInitialContext(aContext);

      ComboPooledDataSource cpds = new ComboPooledDataSource();

      cpds.setDriverClass(getConfig().getDriver());

      //loads the jdbc driver
      cpds.setJdbcUrl(getConfig().getUrl());
      cpds.setUser(getConfig().getUser());
      cpds.setPassword(getConfig().getPassword());
      cpds.setMaxPoolSize(Integer.valueOf(getConfig().getMaxActive()));
      cpds.setMinPoolSize(Integer.valueOf(getConfig().getMaxIdle()));
      cpds.setAcquireIncrement(1);

      aContext.rebind(getContextName(), cpds);
      setDataSource((DataSource) aContext.lookup(getContextName()));
    }
    catch (PropertyVetoException e) {
View Full Code Here

   private ComboPooledDataSource pooledDataSource;

   @Override
   public void start(ConnectionFactoryConfig config) throws CacheLoaderException {
      logFileOverride();
      pooledDataSource = new ComboPooledDataSource();
      pooledDataSource.setProperties(new Properties());
      try {
         pooledDataSource.setDriverClass(config.getDriverClass()); //loads the jdbc driver
      } catch (PropertyVetoException e) {
         String message = "Error while instatianting JDBC driver: '" + config.getDriverClass();
View Full Code Here

TOP

Related Classes of com.mchange.v2.c3p0.ComboPooledDataSource

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.