Package com.mchange.v2.c3p0

Examples of com.mchange.v2.c3p0.AbstractComboPooledDataSource


        toInt(ps.getProperty("maxPoolSize")), toInt(ps.getProperty("minPoolSize")), toInt(ps.getProperty("initialPoolSize")),
        toInt(ps.getProperty("maxIdleTime")),toInt(ps.getProperty("acquireIncrement")));
  }
 
  public boolean start() {
    dataSource = new ComboPooledDataSource();
    dataSource.setJdbcUrl(jdbcUrl);
    dataSource.setUser(user);
    dataSource.setPassword(password);
    try {dataSource.setDriverClass(driverClass);}
    catch (PropertyVetoException e) {dataSource = null; System.err.println("C3p0Plugin start error"); throw new RuntimeException(e);}
View Full Code Here


   }

   private static ComboPooledDataSource staticDS = null;
   private static synchronized DataSource getDataSource(String url) {
     if (staticDS == null) {
        staticDS = new ComboPooledDataSource();
        try {
           Class.forName(DB_DRIVER_CLASS).newInstance();
           staticDS.setDriverClass(DB_DRIVER_CLASS);
        } catch (Exception e) {
           throw new RuntimeException("Error loading database driver: "+e.getMessage());
View Full Code Here

    this.credentials = credentials;
  }

  @Override
  public final ComboPooledDataSource get() {
    ComboPooledDataSource dataSource = new ComboPooledDataSource();

    try {

      dataSource.setDriverClass(credentials.getDriverClass());
      dataSource.setJdbcUrl(credentials.getUrl());
      dataSource.setUser(credentials.getUser());
      dataSource.setPassword(credentials.getPassword());

      configureDataSource(dataSource);

    } catch (PropertyVetoException e) {
View Full Code Here

      {
        Config.DATABASE_MAX_CONNECTIONS = 2;
        _log.warning("A minimum of " + Config.DATABASE_MAX_CONNECTIONS + " db connections are required.");
      }
     
      _source = new ComboPooledDataSource();
      _source.setAutoCommitOnClose(true);
     
      _source.setInitialPoolSize(10);
      _source.setMinPoolSize(10);
      _source.setMaxPoolSize(Math.max(10, Config.DATABASE_MAX_CONNECTIONS));
View Full Code Here

            String username = p.getProperty(KEY_DB_CONNECTION_USERNAME);
            String password = p.getProperty(KEY_DB_CONNECTION_PASSWORD);

            System.setProperty("com.mchange.v2.c3p0.management.ManagementCoordinator", "com.mchange.v2.c3p0.management.NullManagementCoordinator");

            ComboPooledDataSource cpds = new ComboPooledDataSource(connectionName);
      cpds.setDriverClass(driver);
            cpds.setJdbcUrl(url);
      cpds.setUser(username);
      cpds.setPassword(password);
     
      cpds.setAutoCommitOnClose(autoCommit);
     
      cpds.setMaxPoolSize(Integer.parseInt(maxPoolSize));
      cpds.setMinPoolSize(Integer.parseInt(minPoolSize));
      cpds.setAcquireIncrement(Integer.parseInt(acquireIncrement));
      cpds.setInitialPoolSize(Integer.parseInt(initialPoolSize));
      cpds.setMaxIdleTime(Integer.parseInt(maxIdleTime));

            connectionPoolDataSourcesMap.put(connectionName, cpds);
            log.debug("created ds for " + connectionName + " with properties: " + c3p0props);
    } catch (Throwable e) {
      log.error("Failed to create data source for " + connectionName + " with properties: " + c3p0props + ": " + e.getMessage());
View Full Code Here

   private ComboPooledDataSource pooledDataSource;

   @Override
   public void start(ConnectionFactoryConfig config, ClassLoader classLoader) throws CacheLoaderException {
      logFileOverride(classLoader);
      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

//                     0,
//                     100 );

    //ds_unpooled = DataSources.unpooledDataSource(jdbc_url, username, password);
    //ds_pooled = DataSources.pooledDataSource( ds_unpooled );
      ds_unpooled = new DriverManagerDataSource();

       //DataSource ds_unpooled_screwy = C3P0TestUtils.unreliableCommitDataSource( ds_unpooled );
       //ds_pooled = DataSources.pooledDataSource( ds_unpooled_screwy );

//     PoolConfig pc = new PoolConfig();
View Full Code Here

      usage();
  */
 
  try
      {
    DriverManagerDataSource dmds = new DriverManagerDataSource();
    //dmds.setJdbcUrl( jdbcUrl );
    //dmds.setUser( username );
    //dmds.setPassword( password );
    try { drop( dmds ); }
    catch (Exception e)
View Full Code Here

      usage();
 
 
  try
      {
    DriverManagerDataSource dmds = new DriverManagerDataSource();
    dmds.setJdbcUrl( jdbcUrl );
    dmds.setUser( username );
    dmds.setPassword( password );
    try { drop( dmds ); }
    catch (Exception e)
        { /* Ignore */ }
    create( dmds );

View Full Code Here

      usage();
  */
 
  try
      {
    DriverManagerDataSource dmds = new DriverManagerDataSource();
    //dmds.setJdbcUrl( jdbcUrl );
    //dmds.setUser( username );
    //dmds.setPassword( password );
    try { drop( dmds ); }
    catch (Exception e)
View Full Code Here

TOP

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

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.