Java Code Examples for oracle.jdbc.pool.OracleDataSource#setUser()

The following examples show how to use oracle.jdbc.pool.OracleDataSource#setUser() . 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);
  }
}