oracle.jdbc.pool.OracleDataSource Java Examples

The following examples show how to use oracle.jdbc.pool.OracleDataSource. 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 File: OracleDataSourceProvider.java    From Patterdale with 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 File: DBUtil.java    From gemfirexd-oss with 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 File: DBUtil.java    From gemfirexd-oss with 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 File: OracleDataSourceProvider.java    From Patterdale with 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 File: AbstractTest.java    From hibernate-master-class with Apache License 2.0 4 votes vote down vote up
@Override
public Class<? extends DataSource> dataSourceClassName() {
    return OracleDataSource.class;
}
 
Example #6
Source File: Test_DbConnOracle.java    From ats-framework with 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());
}