Package org.jasig.portal.rdbm

Examples of org.jasig.portal.rdbm.DatabaseMetaDataImpl$OracleDb


            ds = getJndiDataSource(name);
            if (ds != null) {
                if (LOG.isInfoEnabled()) {
                    LOG.info("Creating DataSource instance for " + name);
                }
                dbMetaData = new DatabaseMetaDataImpl(ds);
                namedDataSources.put(name, ds);
                return ds;
                }                              
            }
       
        // get here if not getDatasourceFromJndi OR jndi lookup returned null
        // try to get datasource via properties
        try {
            final InputStream jdbcPropStream = RDBMServices.class.getResourceAsStream(PROP_FILE);
           
            try {
                final Properties jdbpProperties = new Properties();
                jdbpProperties.load(jdbcPropStream);

                final IPooledDataSourceFactory pdsf = PooledDataSourceFactoryFactory.getPooledDataSourceFactory();

                final String driverClass = jdbpProperties.getProperty("jdbcDriver");
                final String username = jdbpProperties.getProperty("jdbcUser");
                final String password = jdbpProperties.getProperty("jdbcPassword");
                final String url = jdbpProperties.getProperty("jdbcUrl");
                boolean usePool = true;
                if (jdbpProperties.getProperty("jdbcUsePool")!=null)
                    usePool = Boolean.valueOf(jdbpProperties.getProperty("jdbcUsePool")).booleanValue();

                if (usePool) {
                    //Try using a pooled DataSource
                    try {
                        ds = pdsf.createPooledDataSource(driverClass, username, password, url);

                        if (LOG.isInfoEnabled()) {
                            LOG.info("Creating DataSource instance for pooled JDBC");
                        }
                       
                        namedDataSources.put(PORTAL_DB,ds);
                        jdbcUrl = url;
                        jdbcUser = username;
                        jdbcDriver = driverClass;
                        dbMetaData = new DatabaseMetaDataImpl(ds);
                    }
                    catch (Exception e) {
                        LOG.error("Error using pooled JDBC data source.", e);
                    }
                }

                if (ds == null && driverClass != null) {
                    //Pooled DataSource isn't being used or failed during creation
                    try {
                        final Driver d = (Driver)Class.forName(driverClass).newInstance();
                        ds = new GenericDataSource(d, url, username, password);

                        if (LOG.isInfoEnabled()) {
                            LOG.info("Creating DataSource for JDBC native");
                        }
                       
                        namedDataSources.put(PORTAL_DB,ds);
                        jdbcUrl = url;
                        jdbcUser = username;
                        jdbcDriver = driverClass;
                        dbMetaData = new DatabaseMetaDataImpl(ds);
                    }
                    catch (Exception e) {
                        LOG.error("JDBC Driver Creation Failed. (" + driverClass + ")", e);
                    }
                }
View Full Code Here

TOP

Related Classes of org.jasig.portal.rdbm.DatabaseMetaDataImpl$OracleDb

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.