Java Code Examples for oracle.jdbc.pool.OracleDataSource

The following examples show how to use oracle.jdbc.pool.OracleDataSource. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Patterdale   Source File: OracleDataSourceProvider.java    License: Apache License 2.0 6 votes vote down vote up
private static OracleDataSource cacheEnabledOracleDataSource(DatabaseDefinition databaseDefinition,
                                                             String password) throws SQLException {
    OracleDataSource ods = new OracleDataSource();
    ods.setImplicitCachingEnabled(true);

    ods.setURL(databaseDefinition.jdbcUrl);
    ods.setUser(databaseDefinition.user);
    ods.setPassword(password);

    Properties props = new Properties();
    props.put("driverType", "thin");
    props.put("MaxStatementsLimit", "250");

    ods.setConnectionProperties(props);

    return ods;
}
 
Example 2
Source Project: gemfirexd-oss   Source File: DBUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a database connection pool object using JDBC 2.0.
 */
private OracleDataSource createConnectionPool() {
  try {
    // Create a OracleConnectionPoolDataSource instance.
    OracleDataSource ds = new OracleDataSource();
    ds.setConnectionCacheName("oraCache");
    ds.setConnectionCachingEnabled(true);
    ds.setURL(TestConfig.tab().stringAt(JtaPrms.jdbcUrl));
    ds.setUser(TestConfig.tab().stringAt(JtaPrms.rdbUser));
    ds.setPassword(TestConfig.tab().stringAt(JtaPrms.rdbPassword));

    Properties cacheProps = new Properties();
    cacheProps.setProperty("MinLimit",
        String.valueOf(TestConfig.tab().intAt(JtaPrms.poolMinLimit)));
    ds.setConnectionCacheProperties(cacheProps);
    return ds;
  } catch (Exception ex) {
    Log.getLogWriter().info("Unable to create connection pool: " + ex, ex);
    throw new HydraRuntimeException("Problem creating Oracle connection pool", ex);
  }
}
 
Example 3
Source Project: gemfirexd-oss   Source File: DBUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a database connection pool object using JDBC 2.0.
 */
private OracleDataSource createConnectionPool() {
  try {
    // Create a OracleConnectionPoolDataSource instance.
    OracleDataSource ds = new OracleDataSource();
    ds.setConnectionCacheName("oraCache");
    ds.setConnectionCachingEnabled(true);
    ds.setURL(TestConfig.tab().stringAt(JtaPrms.jdbcUrl));
    ds.setUser(TestConfig.tab().stringAt(JtaPrms.rdbUser));
    ds.setPassword(TestConfig.tab().stringAt(JtaPrms.rdbPassword));

    Properties cacheProps = new Properties();
    cacheProps.setProperty("MinLimit",
        String.valueOf(TestConfig.tab().intAt(JtaPrms.poolMinLimit)));
    ds.setConnectionCacheProperties(cacheProps);
    return ds;
  } catch (Exception ex) {
    Log.getLogWriter().info("Unable to create connection pool: " + ex, ex);
    throw new HydraRuntimeException("Problem creating Oracle connection pool", ex);
  }
}
 
Example 4
Source Project: Patterdale   Source File: OracleDataSourceProvider.java    License: Apache License 2.0 5 votes vote down vote up
private static HikariDataSource ds(RuntimeParameters runtimeParameters,
                                   DatabaseDefinition databaseDefinition,
                                   Passwords passwords,
                                   Logger logger) throws SQLException {
    try {
        String password = passwords.byDatabaseName(databaseDefinition.name).value;

        OracleDataSource ods = cacheEnabledOracleDataSource(databaseDefinition, password);

        return new HikariDataSource(jdbcConfig(runtimeParameters, databaseDefinition, ods));
    } catch (Exception e) {
        logger.error("Error occurred initialising Oracle and Hikari data sources.", e);
        throw e;    // caught by the RetryPolicy
    }
}
 
Example 5
Source Project: hibernate-master-class   Source File: AbstractTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Class<? extends DataSource> dataSourceClassName() {
    return OracleDataSource.class;
}
 
Example 6
Source Project: ats-framework   Source File: Test_DbConnOracle.java    License: Apache License 2.0 3 votes vote down vote up
@Test
public void getDataSource() {

    DbConnOracle dbConnection = new DbConnOracle("host", "db", "user", "pass");

    assertEquals(OracleDataSource.class, dbConnection.getDataSource().getClass());
}