if (factory == null) { factory = new FBManagedConnectionFactory(); factory.setDatabase(databaseURL); dataSource = (FBDataSource)factory.createConnectionFactory(); urlToDataSourceMap.put(databaseURL, dataSource); urlToMCFMap.put(databaseURL, factory); }   factory.setConnectionRequestInfo(FBConnectionHelper.getCri( info, factory.getDefaultConnectionRequestInfo()));
FBDataSource dataSource = null; synchronized (mcfToDataSourceMap) { dataSource = (FBDataSource)mcfToDataSourceMap.get(mcf);  if (dataSource == null) { dataSource = (FBDataSource)mcf.createConnectionFactory(); mcfToDataSourceMap.put(mcf, dataSource); } }
    public Connection connect(String url, java.util.Properties info)        throws SQLException    {        if (url == null || !url.startsWith(FIREBIRD_PROTOCOL))        {            return null;        } // end of if ()        try {            int iQuestionMark = url.indexOf("?");            if (iQuestionMark > -1) {                if(info == null) info = new Properties();                String propString = url.substring(iQuestionMark+1);                StringTokenizer st = new StringTokenizer(propString,"&");                while(st.hasMoreTokens()) {                    String propertyString = st.nextToken();                    int iIs = propertyString.indexOf("=");                    if(iIs > -1) {                        String property = propertyString.substring(0, iIs);                        String value = propertyString.substring(iIs+1);                        info.setProperty(property,value);                    }                }                url = url.substring(0,iQuestionMark);            }            FBConnectionRequestInfo conCri =                FBConnectionHelper.getCri(info, null);            // extract the user            String user = info.getProperty(USER);            if (user == null)                user = conCri.getStringProperty(GDS.isc_dpb_user_name);            if (user == null)                throw new SQLException(                    "User for database connection not specified.");            // extract the password            String password = info.getProperty(PASSWORD);            if (password == null)                password = conCri.getStringProperty(GDS.isc_dpb_password);            if (password == null)                throw new SQLException(                    "Password for database connection not specified.");            // extract the database URL            String databaseURL = url.substring(FIREBIRD_PROTOCOL.length());//          Datasource can't be cached alone because it is necessary to update //          the cri in the ManagedConnectionFactory each time the driver get //          a new connection from the DataSource            FBManagedConnectionFactory factory =                (FBManagedConnectionFactory)urlToMCFMap.get(databaseURL);            FBDataSource dataSource =                (FBDataSource)urlToDataSourceMap.get(databaseURL);            if (factory == null) {                factory = new FBManagedConnectionFactory();                factory.setDatabase(databaseURL);                dataSource = (FBDataSource)factory.createConnectionFactory();                urlToDataSourceMap.put(databaseURL, dataSource);                urlToMCFMap.put(databaseURL, factory);            } // end of if ()            // set connection request info            factory.setConnectionRequestInfo(FBConnectionHelper.getCri(                info, factory.getDefaultConnectionRequestInfo()));                                return dataSource.getConnection(user, password);        } catch(javax.resource.ResourceException resex) {            throw new SQLException(resex.getMessage());        }    }