Examples of addConnectionProperty()


Examples of com.alibaba.druid.pool.DruidDataSource.addConnectionProperty()

        dataSource.setValidConnectionChecker(null);
        dataSource.setValidConnectionCheckerClassName(null);
        Assert.assertEquals(null, dataSource.getValidConnectionChecker());

        dataSource.addConnectionProperty("user", "ljw");
        Assert.assertEquals(1, dataSource.getConnectProperties().size());

        Assert.assertEquals(0, dataSource.getConnectionInitSqls().size());
        dataSource.setConnectionInitSqls(Arrays.<Object> asList("SELECT 1", null, ""));
        Assert.assertEquals(1, dataSource.getConnectionInitSqls().size());
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource.addConnectionProperty()

    Iterator props = map.keySet().iterator();
    while (props.hasNext()) {
      String propertyName = (String) props.next();
      if (propertyName.startsWith(ADD_DRIVER_PROPS_PREFIX)) {
        String value = (String) map.get(propertyName);
        basicDataSource.addConnectionProperty(propertyName.substring(ADD_DRIVER_PROPS_PREFIX_LENGTH), value);
      } else if (PROBE.hasWritableProperty(basicDataSource, propertyName)) {
        String value = (String) map.get(propertyName);
        Object convertedValue = convertValue(basicDataSource, propertyName, value);
        PROBE.setObject(basicDataSource, propertyName, convertedValue);
      }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource.addConnectionProperty()

    MetaObject metaDataSource = MetaObject.forObject(basicDataSource);
    while (props.hasNext()) {
      String propertyName = (String) props.next();
      if (propertyName.startsWith(ADD_DRIVER_PROPS_PREFIX)) {
        String value = (String) map.get(propertyName);
        basicDataSource.addConnectionProperty(propertyName.substring(ADD_DRIVER_PROPS_PREFIX_LENGTH), value);
      } else if (metaDataSource.hasSetter(propertyName)) {
        String value = (String) map.get(propertyName);
        Object convertedValue = convertValue(basicDataSource, propertyName, value);
        metaDataSource.setValue(propertyName, convertedValue);
      }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource.addConnectionProperty()

      for (Object o : map.keySet()) {
        String propertyName = (String) o;
        if (propertyName.startsWith(ADD_DRIVER_PROPS_PREFIX)) {
          String value = (String) map.get(propertyName);
          basicDataSource.addConnectionProperty(propertyName.substring(ADD_DRIVER_PROPS_PREFIX_LENGTH), value);
        }
      }
    }
    return basicDataSource;
  }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource.addConnectionProperty()

    Iterator props = map.keySet().iterator();
    while (props.hasNext()) {
      String propertyName = (String) props.next();
      if (propertyName.startsWith(ADD_DRIVER_PROPS_PREFIX)) {
        String value = (String) map.get(propertyName);
        basicDataSource.addConnectionProperty(propertyName.substring(ADD_DRIVER_PROPS_PREFIX_LENGTH), value);
      } else if (PROBE.hasWritableProperty(basicDataSource, propertyName)) {
        String value = (String) map.get(propertyName);
        Object convertedValue = convertValue(basicDataSource, propertyName, value);
        PROBE.setObject(basicDataSource, propertyName, convertedValue);
      }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource.addConnectionProperty()

      Iterator props = map.keySet().iterator();
      while (props.hasNext()) {
        String propertyName = (String) props.next();
        if (propertyName.startsWith(ADD_DRIVER_PROPS_PREFIX)) {
          String value = (String) map.get(propertyName);
          basicDataSource.addConnectionProperty(propertyName.substring(ADD_DRIVER_PROPS_PREFIX_LENGTH), value);
        }
      }
    }
    return basicDataSource;
  }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource.addConnectionProperty()

    }

    private void shutdownDB() throws Exception {
        logger.info("Shutting down DB..");
        BasicDataSource ds = (BasicDataSource) applicationContext.getBean(DATA_SOURCE_BEAN_NAME);
        ds.addConnectionProperty("shutdown", "true");
       
        for (int i = 0; i < 1000; i++) {
            try{
                ds.getConnection();
                Thread.sleep(10);
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource.addConnectionProperty()

    Iterator props = map.keySet().iterator();
    while (props.hasNext()) {
      String propertyName = (String) props.next();
      if (propertyName.startsWith(ADD_DRIVER_PROPS_PREFIX)) {
        String value = (String) map.get(propertyName);
        basicDataSource.addConnectionProperty(propertyName.substring(ADD_DRIVER_PROPS_PREFIX_LENGTH), value);
      } else if (PROBE.hasWritableProperty(basicDataSource, propertyName)) {
        String value = (String) map.get(propertyName);
        Object convertedValue = convertValue(basicDataSource, propertyName, value);
        PROBE.setObject(basicDataSource, propertyName, convertedValue);
      }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource.addConnectionProperty()

      Iterator props = map.keySet().iterator();
      while (props.hasNext()) {
        String propertyName = (String) props.next();
        if (propertyName.startsWith(ADD_DRIVER_PROPS_PREFIX)) {
          String value = (String) map.get(propertyName);
          basicDataSource
              .addConnectionProperty(propertyName.substring(ADD_DRIVER_PROPS_PREFIX_LENGTH), value);
        }
      }
    }
    return basicDataSource;
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource.addConnectionProperty()

        dbcpDs.setUrl(url);
        dbcpDs.setUsername(userName);
        dbcpDs.setPassword(password);

        if (dataMediaType.isOracle()) {
            dbcpDs.addConnectionProperty("restrictGetTables", "true");
            dbcpDs.setValidationQuery("select 1 from dual");
        } else if (dataMediaType.isMysql()) {
            // open the batch mode for mysql since 5.1.8
            dbcpDs.addConnectionProperty("useServerPrepStmts", "true");
            dbcpDs.addConnectionProperty("rewriteBatchedStatements", "true");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.