Package com.jolbox.bonecp

Examples of com.jolbox.bonecp.BoneCPConfig


      XMLConfiguration config = new XMLConfiguration(((new File(
          this.getClass().getResource("/").getPath()).getPath())
          .replace("\\", "/") + "/DBConfig.xml").replace("%20", " "));
      Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
      // 初始化连接池
      BoneCPConfig boneConf = new BoneCPConfig();
      // 数据库URL连接
      boneConf.setJdbcUrl("jdbc:microsoft:sqlserver://"
          + config.getString("address") + ":"
          + config.getString("port") + ";databasename="
          + config.getString("database"));
      // 设置数据库连接用户名
      boneConf.setUsername(config.getString("username"));
      // 设置数据库连接密码
      boneConf.setPassword(config.getString("password"));
      // 设置连接池在每个分区中的最大连接数
      boneConf.setMaxConnectionsPerPartition(50);
      // 设置连接池设在每个分区中的最小连接数
      boneConf.setMinConnectionsPerPartition(10);
      // 连接释放处理
      boneConf.setReleaseHelperThreads(3);
      // 当连接池中的连接耗尽的时候 BoneCP一次同时获取的连接数
      boneConf.setAcquireIncrement(10);
      // 设置分区(设置 3个分区)
      boneConf.setPartitionCount(3);
      // 设置连接空闲时间(分钟)
      boneConf.setIdleMaxAge(40);
      // 每60秒检查所有连接池中的空闲连接
      boneConf.setIdleConnectionTestPeriod(60);
      boneCp = new BoneCP(boneConf);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here


      XMLConfiguration config = new XMLConfiguration(((new File(
          this.getClass().getResource("/").getPath()).getPath())
          .replace("\\", "/") + "/DBConfig.xml").replace("%20", " "));
      Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
      // 初始化连接池
      BoneCPConfig boneConf = new BoneCPConfig();
      // 数据库URL连接
      boneConf.setJdbcUrl("jdbc:microsoft:sqlserver://"
          + config.getString("address") + ":"
          + config.getString("port") + ";databasename="
          + config.getString("database"));
      // 设置数据库连接用户名
      boneConf.setUsername(config.getString("username"));
      // 设置数据库连接密码
      boneConf.setPassword(config.getString("password"));
      // 设置连接池在每个分区中的最大连接数
      boneConf.setMaxConnectionsPerPartition(50);
      // 设置连接池设在每个分区中的最小连接数
      boneConf.setMinConnectionsPerPartition(10);
      // 连接释放处理
      boneConf.setReleaseHelperThreads(3);
      // 当连接池中的连接耗尽的时候 BoneCP一次同时获取的连接数
      boneConf.setAcquireIncrement(10);
      // 设置分区(设置 3个分区)
      boneConf.setPartitionCount(3);
      // 设置连接空闲时间(分钟)
      boneConf.setIdleMaxAge(40);
      // 每60秒检查所有连接池中的空闲连接
      boneConf.setIdleConnectionTestPeriod(60);
      boneCp = new BoneCP(boneConf);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      XMLConfiguration config = new XMLConfiguration(((new File(
          this.getClass().getResource("/").getPath()).getPath())
          .replace("\\", "/") + "/DBConfig.xml").replace("%20", " "));
      Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
      // 初始化连接池
      BoneCPConfig boneConf = new BoneCPConfig();
      // 数据库URL连接
      boneConf.setJdbcUrl("jdbc:microsoft:sqlserver://"
          + config.getString("address") + ":"
          + config.getString("port") + ";databasename="
          + config.getString("database"));
      // 设置数据库连接用户名
      boneConf.setUsername(config.getString("username"));
      // 设置数据库连接密码
      boneConf.setPassword(config.getString("password"));
      // 设置连接池在每个分区中的最大连接数
      boneConf.setMaxConnectionsPerPartition(50);
      // 设置连接池设在每个分区中的最小连接数
      boneConf.setMinConnectionsPerPartition(10);
      // 连接释放处理
      boneConf.setReleaseHelperThreads(3);
      // 当连接池中的连接耗尽的时候 BoneCP一次同时获取的连接数
      boneConf.setAcquireIncrement(10);
      // 设置分区(设置 3个分区)
      boneConf.setPartitionCount(3);
      // 设置连接空闲时间(分钟)
      boneConf.setIdleMaxAge(40);
      // 每60秒检查所有连接池中的空闲连接
      boneConf.setIdleConnectionTestPeriod(60);
      boneCp = new BoneCP(boneConf);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

  private BoneCPConfig config1;
  private BoneCPConfig config2;

  @BeforeMethod
  public final void pre() {
    config1 = new BoneCPConfig();
    config1.setJdbcUrl("jdbc:hsqldb:mem:muldb1;sql.syntax_mys=true");
    config1.setUsername("sa");
    config1.setPassword("");
    config1.setPartitionCount(1);
    config1.setMaxConnectionsPerPartition(2);

    config2 = new BoneCPConfig();
    config2.setJdbcUrl("jdbc:hsqldb:mem:muldb2;sql.syntax_mys=true");
    config2.setUsername("sa");
    config2.setPassword("");
    config2.setPartitionCount(1);
    config2.setMaxConnectionsPerPartition(2);
View Full Code Here

  @BeforeMethod
  public final void pre() {
    String database = "db" + dbCount.incrementAndGet();

    config = new BoneCPConfig();
    config.setJdbcUrl("jdbc:hsqldb:mem:" + database + ";sql.syntax_mys=true");
    config.setUsername("sa");
    config.setPassword("");
  }
View Full Code Here

        ((BoneCPDataSource) dataSource).close();
    }

    @Override
    public DataSource pool(final String name, final DataSource ds, final Properties properties) {
        final BoneCPConfig config;
        final BoneCP pool;
        try {
            config = new BoneCPConfig(prefixedProps(properties));
            pool = new BoneCP(config);
        } catch (Exception e) {
            throw new IllegalArgumentException(e);
        }
        return build(BoneCPDataSourceProvidedPool.class, new BoneCPDataSourceProvidedPool(pool), new Properties());
View Full Code Here

      Class.forName("com.mysql.jdbc.Driver");
    } catch (ClassNotFoundException e) {
      throw new AssertionError("Could not find JDBC driver: " + e);
    }

    final BoneCPConfig config = new BoneCPConfig();
    config.setJdbcUrl("jdbc:mysql://localhost:3306/shardedtest");
    config.setMaxConnectionsPerPartition(10);
    config.setMinConnectionsPerPartition(2);
    config.setPartitionCount(1);
    config.setLazyInit(true);
    config.setUsername("sam");
    config.setPassword("");
    BoneCPDataSource ds = new BoneCPDataSource(config);
    ExecutorService es = Executors.newCachedThreadPool();

    String MYSQL_SCHEMAS = "avro_schemas";
    mab1 = new ShardableMysqlAB(es, ds, "user", "profile", MYSQL_SCHEMAS, User.SCHEMA$, AvroFormat.JSON, KEYTX);
View Full Code Here

      Class.forName("com.mysql.jdbc.Driver");
    } catch (ClassNotFoundException e) {
      throw new AssertionError("Could not find JDBC driver: " + e);
    }

    final BoneCPConfig config = new BoneCPConfig();
    config.setJdbcUrl("jdbc:mysql://localhost:3306/avrobasetest");
    config.setMaxConnectionsPerPartition(50);
    config.setPartitionCount(4);
    config.setLazyInit(true);
    config.setUsername("bagcheck");
    config.setPassword("");
    dataSource = new BoneCPDataSource(config);
  }
View Full Code Here

      Class.forName("com.mysql.jdbc.Driver");
    } catch (ClassNotFoundException e) {
      throw new AssertionError("Could not find JDBC driver: " + e);
    }

    final BoneCPConfig config = new BoneCPConfig();
    config.setJdbcUrl("jdbc:mysql://localhost:3406/hstest");
    config.setMaxConnectionsPerPartition(50);
    config.setPartitionCount(4);
    config.setLazyInit(true);
    config.setUsername("test");
    config.setPassword("");
    return new BoneCPDataSource(config);
  }
View Full Code Here

    }
    String connectionPooler = HiveConf.getVar(conf,
        HiveConf.ConfVars.METASTORE_CONNECTION_POOLING_TYPE).toLowerCase();

    if ("bonecp".equals(connectionPooler)) {
      BoneCPConfig config = new BoneCPConfig();
      config.setJdbcUrl(driverUrl);
      config.setMaxConnectionsPerPartition(10);
      config.setPartitionCount(1);
      config.setUser(user);
      config.setPassword(passwd);
      connPool = new BoneCPDataSource(config);
    } else if ("dbcp".equals(connectionPooler)) {
      ObjectPool objectPool = new GenericObjectPool();
      ConnectionFactory connFactory = new DriverManagerConnectionFactory(driverUrl, user, passwd);
      // This doesn't get used, but it's still necessary, see
View Full Code Here

TOP

Related Classes of com.jolbox.bonecp.BoneCPConfig

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.