Package com.mchange.v2.c3p0

Examples of com.mchange.v2.c3p0.C3P0ProxyStatement


        }
       
        if (DB.datasource == null) {
            return true;
        } else {
            ComboPooledDataSource ds = (ComboPooledDataSource) DB.datasource;
            if (!p.getProperty("db.driver").equals(ds.getDriverClass())) {
                return true;
            }
            if (!p.getProperty("db.url").equals(ds.getJdbcUrl())) {
                return true;
            }
            if (!p.getProperty("db.user", "").equals(ds.getUser())) {
                return true;
            }
            if (!p.getProperty("db.pass", "").equals(ds.getPassword())) {
                return true;
            }
        }

        if (!p.getProperty("db.destroyMethod", "").equals(DB.destroyMethod)) {
View Full Code Here


        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

    return jpaVendorAdapter;
  }

  @Bean
  public DataSource dataSource() {
    final ComboPooledDataSource dataSource = new ComboPooledDataSource();
    // All options set from the externally loaded properties file!
    return dataSource;
  }
View Full Code Here

    // "LPS");
    try {
      // databaseTester = new MySQLJdbcDatabaseTester(
      // PropertiesUtil.JDBC_DRIVER, jdbc_url,
      // PropertiesUtil.JDBC_USERNAME, PropertiesUtil.JDBC_PASSWD);
      ComboPooledDataSource ds = new ComboPooledDataSource();
      ds.setDriverClass(PropertiesUtil.JDBC_DRIVER);
      ds.setUser(PropertiesUtil.JDBC_USERNAME);
      ds.setPassword(PropertiesUtil.JDBC_PASSWD);
      ds.setJdbcUrl(jdbc_url);

      if (PropertiesUtil.JDBC_DRIVER.toLowerCase().contains("mysql")) {
        logger.info("use mysql datasource tester.");
        jdbc_url = PropertiesUtil.JDBC_URL
            + "&sessionVariables=FOREIGN_KEY_CHECKS=0";
        ds.setJdbcUrl(jdbc_url);
        databaseTester = new MySQLDataSourceDatabaseTester(ds);
      } else if (PropertiesUtil.JDBC_DRIVER.toLowerCase().contains(
          "oracle")) {
        logger.info("use oracle datasource tester.");
        databaseTester = new OracleDataSourceDatabaseTester(ds,
View Full Code Here

  }

  private static DataSource createDataSource() throws IOException {
    Properties properties = new Properties();
    properties.load(ConfigurationDbImplTest.class.getResourceAsStream("/jdbc.properties"));
    ComboPooledDataSource result = new ComboPooledDataSource();
    try {
      result.setDriverClass(properties.getProperty("jdbc.driverClassName"));
    } catch (PropertyVetoException e) {
      throw new RuntimeException("Cannot access JDBC Driver: org.h2.Driver", e);
    }
    result.setJdbcUrl(properties.getProperty("jdbc.url"));
    result.setUser(properties.getProperty("jdbc.username"));
    result.setPassword(properties.getProperty("jdbc.password"));
    result.setMinPoolSize(10);
    result.setMaxPoolSize(300);
    result.setInitialPoolSize(10);
    result.setAcquireIncrement(5);
    result.setMaxStatements(0);
    result.setIdleConnectionTestPeriod(60);
    result.setAcquireRetryAttempts(30);
    result.setBreakAfterAcquireFailure(false);
    result.setTestConnectionOnCheckout(false);
    return result;
  }
View Full Code Here

      throw new RuntimeException("Cannot get dataset.", e);
    }
  }

  private static DataSource createDataSource(Properties jdbcProperties) {
    ComboPooledDataSource dataSource = new ComboPooledDataSource();
    try {
      dataSource.setDriverClass(jdbcProperties.getProperty(JdbcConstants.JDBC_DRIVER));
    } catch (PropertyVetoException e) {
      throw new RuntimeException("Cannot create C3P0 data source", e);
    }
    dataSource.setJdbcUrl(jdbcProperties.getProperty(JdbcConstants.JDBC_URL));
    dataSource.setUser(jdbcProperties.getProperty(JdbcConstants.JDBC_USERNAME));
    dataSource.setPassword(jdbcProperties.getProperty(JdbcConstants.JDBC_PASSWORD));
    return dataSource;
  }
View Full Code Here

*/
public class C3P0DataSourceCreator extends AbstractDataSourceCreator {

  @Override
  protected DataSource createDataSource() {
    return new ComboPooledDataSource();
  }
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 {
         pooledDataSource.setDriverClass(config.getDriverClass()); //loads the jdbc driver
      } catch (PropertyVetoException e) {
         log.errorInstantiatingJdbcDriver(config.getDriverClass(), e);
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

                "DBPool '" + dbURL + "' could not be created: " +
                "Max connections must be greater than zero!");
        }

       
        datasource = new ComboPooledDataSource();
        try {
            datasource.setDriverClass(dbDriver);
        } catch (PropertyVetoException e) {
            throw new SchedulerException("Problem setting driver class name on datasource: " + e.getMessage(), e);
       
View Full Code Here

TOP

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

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.