Examples of JdbcConnectionPool


Examples of org.h2.jdbcx.JdbcConnectionPool

        pool.setMaxConnections(poolSize);
        return pool;
    }

    private void testConnect() throws SQLException {
        JdbcConnectionPool pool = getConnectionPool(3);
        for (int i = 0; i < 100; i++) {
            Connection conn = pool.getConnection();
            conn.close();
        }
        pool.dispose();
        DataSource ds = pool;
        assertThrows(IllegalStateException.class, ds).
                getConnection();
        assertThrows(UnsupportedOperationException.class, ds).
                getConnection(null, null);
View Full Code Here

Examples of org.h2.jdbcx.JdbcConnectionPool

        thenTheDatabaseShouldBeUpdated();
    }

    private void givenSomeDataSourceWithAutoCommitSetTo(boolean autoCommit) {
        String url = "jdbc:h2:mem:" + this.getClass().getSimpleName() + System.currentTimeMillis();
        JdbcConnectionPool pool = JdbcConnectionPool.create(url, "sa", "");
        dataSource = new AutoCommitTestDataSource(pool, autoCommit);
        repository = new JDBCStateRepository(dataSource, "TOGGLZ", true,
            DefaultMapSerializer.multiline());
    }
View Full Code Here

Examples of org.h2.jdbcx.JdbcConnectionPool

    private QueryRunner qr;

    public QueryRunnerProvider(ServletContext servletContext) throws Exception {
        Class.forName("org.h2.Driver");

        JdbcConnectionPool pool = JdbcConnectionPool.create("jdbc:h2:" + servletContext.getRealPath("/WEB-INF/h2") + ";LOCK_MODE=0", "sa", "");

        qr = new QueryRunner(pool);

        Object obj = qr.query("show tables", new ScalarHandler<Object>());
        if (obj == null) {
View Full Code Here

Examples of org.h2.jdbcx.JdbcConnectionPool

    public QueryRunner get() {
        return qr;
    }

    public void dispose() {
        JdbcConnectionPool pool = (JdbcConnectionPool) qr.getDataSource();
        pool.dispose();
    }
View Full Code Here

Examples of org.h2.jdbcx.JdbcConnectionPool

    @Inject
    private TextEncryptor textEncryptor;

    @Bean(destroyMethod="dispose")
    public DataSource dataSource() {
      JdbcConnectionPool dataSource = JdbcConnectionPool.create(environment.getProperty("database.url"),
          environment.getProperty("database.username"), environment.getProperty("database.password"));
      new DatabaseUpgrader(dataSource, environment, textEncryptor).run();
      return dataSource;
    }
View Full Code Here

Examples of org.h2.jdbcx.JdbcConnectionPool

    protected AbstractBlobStore store;
    private Connection sentinel;

    public void setUp() throws Exception {
        Class.forName("org.h2.Driver");
        JdbcConnectionPool cp = JdbcConnectionPool.create("jdbc:h2:mem:", "", "");
        sentinel = cp.getConnection();
        DbBlobStore blobStore = new DbBlobStore();
        blobStore.setConnectionPool(cp);
        blobStore.setBlockSize(128);
        blobStore.setBlockSizeMin(32);
        this.store = blobStore;
View Full Code Here

Examples of org.xmlBlaster.util.queue.jdbc.JdbcConnectionPool

      this.serverScopeOne.setTopicAccessor(new TopicAccessor(this.serverScopeOne));
      ServerEntryFactory sf = new ServerEntryFactory();
      sf.initialize(this.serverScopeOne);
      String queueCfg = this.serverScopeOne.getProperty().get("QueuePlugin[JDBC][1.0]", (String) null);
      Properties queueProps = parsePropertyValue(queueCfg);
      JdbcConnectionPool pool = new JdbcConnectionPool();
      pool.initialize(this.serverScopeOne, queueProps);
      CommonTableDatabaseAccessor manager = new CommonTableDatabaseAccessor(pool, sf, "dbupdate.OneToThree", null);
      pool.registerStorageProblemListener(manager);
      manager.setUp();
      return manager;
   }
View Full Code Here

Examples of org.xmlBlaster.util.queue.jdbc.JdbcConnectionPool

   public CommonTableDatabaseAccessor createClientAccessorOne() throws Exception {
      ClientEntryFactory sf = new ClientEntryFactory();
      sf.initialize(this.globalOne);
      String queueCfg = this.globalOne.getProperty().get("QueuePlugin[JDBC][1.0]", (String) null);
      Properties queueProps = parsePropertyValue(queueCfg);
      JdbcConnectionPool pool = new JdbcConnectionPool();
      pool.initialize(this.globalOne, queueProps);
      CommonTableDatabaseAccessor manager = new CommonTableDatabaseAccessor(pool, sf, "dbupdate.ClientOneToThree", null);
      pool.registerStorageProblemListener(manager);
      manager.setUp();
      return manager;
   }
View Full Code Here

Examples of org.xmlBlaster.util.queue.jdbc.JdbcConnectionPool

           
         }
         Properties props = new Properties();
         PropertiesInfo tmpInfo = new PropertiesInfo(props);
         InfoHelper.fillInfoWithEntriesFromInfo(tmpInfo, info);
         this.connectionPool = new JdbcConnectionPool();
         this.connectionPool.initialize(glob, props);
         this.initCount++;
         String createInterceptorClass = info.get("db.createInterceptor.class", null);
         if (createInterceptorClass != null) {
            ClassLoader cl = this.getClass().getClassLoader();
View Full Code Here

Examples of org.xmlBlaster.util.queue.jdbc.JdbcConnectionPool

         pluginInfo.getParameters().put("connectionBusyTimeout", "10000");
         pluginInfo.getParameters().put("maxWaitingThreads", "" + maxWaitingThreads);
         pluginInfo.getParameters().put("connectionPoolSize", "" + numConn);

         JdbcConnectionPool pool = new JdbcConnectionPool();
         pool.initialize(ownGlobal, pluginInfo.getParameters());

         Connection[] conn = new Connection[numConn];        
         for (int i=0; i < numConn; i++) {
            log.info(" getting connection " + i);
            conn[i] = pool.getConnection();
            assertNotNull("The connection " + i + " shall not be null", conn[i]);
         }
        
         log.info(" getting extra connection");
        
         Connection extraConn = null;
         try {
            extraConn = pool.getConnection();
            assertTrue("An Exception should have occured here: ", false);
         }
         catch (Exception ex) {
         }
         // should wait 10 seconds and then return null
         assertNull("the extra connection should be null", extraConn);
         boolean success = true;
         pool.releaseConnection(conn[0], success);
         extraConn = pool.getConnection();
         assertNotNull("the extra connection should not be null", extraConn);
         //pool.releaseConnection(extraConn);

         this.exceptionCount = 0;        
         int expectedEx = 4;
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.