Package org.conical.common.bbl.db
Class DataSourceConfig
java.lang.Object
org.conical.common.bbl.db.DataSourceConfig
This class wraps the information needed to establish a connection or connection
pool to a database. Objects of this class are immutable.
- Author:
- rdoherty
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDataSourceConfig
(String bundleName) Constructs object given a set of parameters in a configuration bundle (i.e.DataSourceConfig
(DatabaseType dbType, String server, int port, String dbName, String user, String password, boolean isPooled) Constructs object using server name, port, and database name (instead of URL).DataSourceConfig
(DatabaseType dbType, String url, String user, String password, boolean isPooled) Constructs object using connection URL. -
Method Summary
-
Field Details
-
DB_TYPE_KEY
- See Also:
-
DB_CONNECTION_URL_KEY
- See Also:
-
DB_SERVER_NAME_KEY
- See Also:
-
DB_SERVER_PORT_KEY
- See Also:
-
DB_NAME_KEY
- See Also:
-
DB_LOGIN_NAME_KEY
- See Also:
-
DB_LOGIN_PASSWORD_KEY
- See Also:
-
DB_CONNECTION_POOLING_KEY
- See Also:
-
-
Constructor Details
-
DataSourceConfig
public DataSourceConfig(DatabaseType dbType, String url, String user, String password, boolean isPooled) Constructs object using connection URL. The URL will be checked against the dbType.- Parameters:
dbType
- type of databaseurl
- connection URLuser
- user to connect aspassword
- password to verify userisPooled
- whether this connection should be pooled
-
DataSourceConfig
public DataSourceConfig(DatabaseType dbType, String server, int port, String dbName, String user, String password, boolean isPooled) Constructs object using server name, port, and database name (instead of URL). A URL specific to the database type is constructed using these elements.- Parameters:
dbType
- type of databaseserver
- database serverport
- port DB is served out ofdbName
- name of database (or Oracle SID)user
- user to connect aspassword
- password to verify userisPooled
- whether this connection should be pooled
-
DataSourceConfig
Constructs object given a set of parameters in a configuration bundle (i.e. properties file). See constants in this class for what values should appear in the properties file. If URL is present, server, port and dbName will be ignored. Pooling setting is not required; default is to create a connection pool.- Parameters:
bundleName
- name of the bundle containing DB connection properties
-
-
Method Details