Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * $Id: 59128 2014-02-13 22:21:35Z mrotteveel $
   * Firebird Open Source J2EE Connector - JDBC Driver
   * Distributable under LGPL license.
   * You may obtain a copy of the License at
   * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * LGPL License for more details.
  * This file was created by members of the firebird development team.
  * All individual contributions remain the Copyright (C) of those
  * individuals.  Contributors to this file are either listed here or
  * can be obtained from a CVS history command.
  * All rights reserved.
 package org.firebirdsql.ds;
Bare-bones implementation of javax.sql.ConnectionPoolDataSource.

Use this class instead of the broken implementation of org.firebirdsql.pool.FBConnectionPoolDataSource.

Please be aware that this is not a connectionpool. This class provides PooledConnection objects for connection pool implementations (eg as provided by a JEE application server). If you need a standalone connectionpool, consider using a connectionpool implementation like c3p0, BoneCP or DBCP.

Mark Rotteveel
     private volatile transient FBDataSource internalDs;
     public PooledConnection getPooledConnection() throws SQLException {
         return getPooledConnection(getUser(), getPassword());
     public PooledConnection getPooledConnection(String userString passwordthrows SQLException {
         if ( == null) {
         return new FBPooledConnection(.getConnection(userpassword));
     private void initialize() throws SQLException {
         synchronized () {
             if ( != null) {
             try {
                 GDSType gdsType = GDSType.getType(getType());
                 if (gdsType == null) {
                     gdsType = GDSFactory.getDefaultGDSType();
                 FBManagedConnectionFactory mcf = new FBManagedConnectionFactory(
                  = (FBDataSourcemcf.createConnectionFactory();
             } catch (ResourceException e) {
                 throw new FBSQLException(e);
     protected void checkNotStarted() {
         if ( != null) {
             throw new IllegalStateException("DataSource already in use. Change of this property is not allowed");
     public Reference getReference() throws NamingException {
         Reference ref = new Reference(getClass().getName(), DataSourceFactory.class.getName(), null);
        return ref;
New to GrepCode? Check out our FAQ X