private Object loadPoolingDataSource(Reference ref) { // If DataSource exists, return it String name = getProperty(ref, "dataSourceName"); PGPoolingDataSource pds = PGPoolingDataSource.getDataSource(name); if (pds != null) { return pds; } // Otherwise, create a new one pds = new PGPoolingDataSource(); pds.setDataSourceName(name); loadBaseDataSource(pds, ref); String min = getProperty(ref, "initialConnections"); if (min != null) { pds.setInitialConnections(Integer.parseInt(min)); } String max = getProperty(ref, "maxConnections"); if (max != null) { pds.setMaxConnections(Integer.parseInt(max)); } return pds; }
private Object loadPoolingDataSource(Reference ref) { // If DataSource exists, return it String name = getProperty(ref, "dataSourceName"); PGPoolingDataSource pds = PGPoolingDataSource.getDataSource(name); if (pds != null) { return pds; } // Otherwise, create a new one pds = new PGPoolingDataSource(); pds.setDataSourceName(name); loadBaseDataSource(pds, ref); String min = getProperty(ref, "initialConnections"); if (min != null) { pds.setInitialConnections(Integer.parseInt(min)); } String max = getProperty(ref, "maxConnections"); if (max != null) { pds.setMaxConnections(Integer.parseInt(max)); } return pds; }
source = new PGPoolingDataSource(); source.setDataSourceName(properties.getProperty("DATABASE_NAME")); source.setServerName("127.0.0.1"); source.setDatabaseName(properties.getProperty("DATABASE_NAME")); source.setUser(properties.getProperty("DATABASE_USER")); source.setPassword(properties.getProperty("DATABASE_PASS")); source.setMaxConnections(50); DataModel model =new PostgreSQLJDBCDataModel( source, "mahout_teble", "user_id", "item_id", "preference", "timestamp" ) )
@Override public DataSource createDataSource(Properties properties) throws SQLException { if (properties == null) { properties = new Properties(); } if(properties.getProperty(JDBC_DATASOURCE_NAME) == null) { properties.setProperty(JDBC_DATASOURCE_NAME, DataSourceFactoryImpl.class.getSimpleName() + "_" + dataSourceCount.getAndAdd(1)); } PGPoolingDataSource dataSource = PGPoolingDataSource.getDataSource(properties.getProperty(JDBC_DATASOURCE_NAME)); if(dataSource == null) { dataSource = new PGPoolingDataSource(); // Set dataSourceName, databaseName, user, and password dataSource.setDataSourceName(properties.getProperty(JDBC_DATASOURCE_NAME)); String url = properties.getProperty(JDBC_URL); if(url != null) { dataSource.setUrl(url); } dataSource.setPortNumber(Integer.valueOf(properties.getProperty(JDBC_PORT_NUMBER, Integer.toString(dataSource.getPortNumber())))); dataSource.setServerName(properties.getProperty(JDBC_SERVER_NAME, dataSource.getServerName())); dataSource.setUser(properties.getProperty(JDBC_USER, dataSource.getUser())); dataSource.setPassword(properties.getProperty(JDBC_PASSWORD, dataSource.getPassword())); dataSource.setDatabaseName(properties.getProperty(JDBC_DATABASE_NAME, dataSource.getDatabaseName())); } return new DataSourceWrapper(dataSource); }
@Override public DataSource createDataSource(Properties properties) throws SQLException { if (properties == null) { properties = new Properties(); } if(properties.getProperty(JDBC_DATASOURCE_NAME) == null) { properties.setProperty(JDBC_DATASOURCE_NAME, DataSourceFactoryImpl.class.getSimpleName() + "_" + dataSourceCount.getAndAdd(1)); } PGPoolingDataSource dataSource = PGPoolingDataSource.getDataSource(properties.getProperty(JDBC_DATASOURCE_NAME)); if(dataSource == null) { dataSource = new PGPoolingDataSource(); // Set dataSourceName, databaseName, user, and password dataSource.setDataSourceName(properties.getProperty(JDBC_DATASOURCE_NAME)); String url = properties.getProperty(JDBC_URL); if(url != null) { dataSource.setUrl(url); } dataSource.setPortNumber(Integer.valueOf(properties.getProperty(JDBC_PORT_NUMBER, Integer.toString(dataSource.getPortNumber())))); dataSource.setServerName(properties.getProperty(JDBC_SERVER_NAME, dataSource.getServerName())); dataSource.setUser(properties.getProperty(JDBC_USER, dataSource.getUser())); dataSource.setPassword(properties.getProperty(JDBC_PASSWORD, dataSource.getPassword())); dataSource.setDatabaseName(properties.getProperty(JDBC_DATABASE_NAME, dataSource.getDatabaseName())); } return new DataSourceWrapper(dataSource); }
@Override public DataSource createDataSource(Properties properties) throws SQLException { if (properties == null) { properties = new Properties(); } PGPoolingDataSource dataSource = new PGPoolingDataSource(); // Set dataSourceName, databaseName, user, and password dataSource.setDataSourceName(properties.getProperty(JDBC_DATASOURCE_NAME)); String url = properties.getProperty(JDBC_URL); if(url != null) { dataSource.setUrl(url); } dataSource.setPortNumber(Integer.valueOf(properties.getProperty(JDBC_PORT_NUMBER, Integer.toString(dataSource.getPortNumber())))); dataSource.setServerName(properties.getProperty(JDBC_SERVER_NAME, dataSource.getServerName())); dataSource.setUser(properties.getProperty(JDBC_USER, dataSource.getUser())); dataSource.setPassword(properties.getProperty(JDBC_PASSWORD, dataSource.getPassword())); dataSource.setDatabaseName(properties.getProperty(JDBC_DATABASE_NAME, dataSource.getDatabaseName())); return new DataSourceWrapper(dataSource); }
private Object loadPoolingDataSource(Reference ref) { // If DataSource exists, return it String name = getProperty(ref, "dataSourceName"); PGPoolingDataSource pds = PGPoolingDataSource.getDataSource(name); if (pds != null) { return pds; } // Otherwise, create a new one pds = new PGPoolingDataSource(); pds.setDataSourceName(name); loadBaseDataSource(pds, ref); String min = getProperty(ref, "initialConnections"); if (min != null) { pds.setInitialConnections(Integer.parseInt(min)); } String max = getProperty(ref, "maxConnections"); if (max != null) { pds.setMaxConnections(Integer.parseInt(max)); } return pds; }
ds = new PGPoolingDataSource(); ds.setMaxConnections(Integer.parseInt((String) db.get("perf_maxconnections"))); ds.setServerName((String) db.get("perf_servername")); InitialContextFactoryForTest.bind("java:fgsmsPerformance", ds); ds = new PGPoolingDataSource(); ds.setMaxConnections(Integer.parseInt((String) db.get("config_maxconnections"))); ds.setServerName((String) db.get("config_servername"));
private Object loadPoolingDataSource(Reference ref) { // If DataSource exists, return it String name = getProperty(ref, "dataSourceName"); PGPoolingDataSource pds = PGPoolingDataSource.getDataSource(name); if (pds != null) { return pds; } // Otherwise, create a new one pds = new PGPoolingDataSource(); pds.setDataSourceName(name); loadBaseDataSource(pds, ref); String min = getProperty(ref, "initialConnections"); if (min != null) { pds.setInitialConnections(Integer.parseInt(min)); } String max = getProperty(ref, "maxConnections"); if (max != null) { pds.setMaxConnections(Integer.parseInt(max)); } return pds; }
public PostgresStore(PostgresConfiguration config, String schema) { this.pool = new PGPoolingDataSource(); this.pool.setUrl(config.getJdbcUrl()); this.pool.setUser(config.getUsername()); this.pool.setPassword(config.getPassword()); this.pool.setCurrentSchema(schema); }
static PGPoolingDataSource createDataSource(PostGISOpts pgopts) { PGPoolingDataSource dataSource = new PGPoolingDataSource(); dataSource.setServerName(pgopts.host()); dataSource.setDatabaseName(pgopts.db()); dataSource.setPortNumber(pgopts.port()); dataSource.setUser(pgopts.user()); if (pgopts.passwd() != null) { dataSource.setPassword(Password.toString(pgopts.passwd())); } return dataSource; }
PGPoolingDataSource nu = new PGPoolingDataSource(); nu.setServerName(server); nu.setPortNumber(port);