/** * Builds up a default DBCP DataSource that easy to use connection factories can use to setup a * connection pool. * * @param url the jdbc url * @param driverName the jdbc driver full qualified class name * @param username * @param password * @param validationQuery the validation query to be used for connection liveliness on borrow, * or null, if no check is to be performed * @return * @throws DataSourceException */ public static ManageableDataSource buildDefaultDataSource( String url, String driverName, String username, String password, String validationQuery) throws DataSourceException { return buildDefaultDataSource( url, driverName, username, password, 10, 1, validationQuery, false, 0); }
public static ManageableDataSource getDefaultDataSource(String host, String user, String passwd, int port, String database, int maxActive, int minIdle, boolean validate) throws DataSourceException { String url = "jdbc:postgresql" + "://" + host + ":" + port + "/" + database; String driver = "org.postgresql.Driver"; return DataSourceUtil.buildDefaultDataSource(url, driver, user, passwd, maxActive, minIdle, validate ? "select now()" : null, false, 0); }
public static DataSource getDefaultDataSource(String alias, String user, String passwd, int maxActive, int minIdle, boolean validate) throws DataSourceException { String dbUrl = "jdbc:oracle:oci:@" + alias; return DataSourceUtil.buildDefaultDataSource(dbUrl, JDBC_DRIVER, user, passwd, maxActive, minIdle, validate ? "select sysdate from dual" : null, false, 0); }
/** * Builds up a default DBCP DataSource that easy to use connection factories * can use to setup a connection pool. * * @param url * the jdbc url * @param driverName * the jdbc driver full qualified class name * @param username * @param password * @param validationQuery * the validation query to be used for connection liveliness on * borrow, or null, if no check is to be performed * @return * @throws DataSourceException */ public static ManageableDataSource buildDefaultDataSource(String url, String driverName, String username, String password, String validationQuery) throws DataSourceException { return buildDefaultDataSource(url, driverName, username, password, 10, 1, validationQuery, false, 0); }
/** * Builds up a default DBCP DataSource that easy to use connection factories * can use to setup a connection pool. * * @param url * the jdbc url * @param driverName * the jdbc driver full qualified class name * @param username * @param password * @param validationQuery * the validation query to be used for connection liveliness on * borrow, or null, if no check is to be performed * @return * @throws DataSourceException */ public static ManageableDataSource buildDefaultDataSource(String url, String driverName, String username, String password, String validationQuery) throws DataSourceException { return buildDefaultDataSource(url, driverName, username, password, 10, 1, validationQuery, false, 0); }
public static ManageableDataSource getDefaultDataSource(String host, String user, String passwd, int port, String instance, int maxActive, int minIdle, boolean validate) throws DataSourceException { String dbUrl = null; if( instance.startsWith("(") ) dbUrl = JDBC_PATH + instance; else if( instance.startsWith("/") ) dbUrl = JDBC_PATH + "//" + host + ":" + port + instance; else dbUrl = JDBC_PATH + host + ":" + port + ":" + instance; return DataSourceUtil.buildDefaultDataSource(dbUrl, JDBC_DRIVER, user, passwd, maxActive, minIdle, validate ? "select sysdate from dual" : null, false, 0); }
DataSource source = DataSourceUtil.buildDefaultDataSource(url, "org.postgresql.Driver", user, passwd, "select now()"); VersionedPostgisDataStore dataStore = createDataStoreInternal(source, namespace, schema);